diff --git a/Cargo.toml b/Cargo.toml index 205ee5b..d8cfa62 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bytesutil" -version = "0.1.0" +version = "0.2.0" authors = ["Yuri Edward "] edition = "2021" description = "Yet another byte utility for Rust" diff --git a/README.MD b/README.MD index 766955d..04c4487 100644 --- a/README.MD +++ b/README.MD @@ -4,10 +4,9 @@ Yet another byte utility for Rust. ## Features -- Decode any type of BPX -- Encode any type of BPX -- Encode and decode BPXSD (BPX structured data) -- Built-in support for BPX packages (type P) +- A java-like ByteBuf. +- Support for encoding numbers and booleans with little-endian or big-endian ordering. +- IO utilities. ## Usage and development diff --git a/src/buffer.rs b/src/buffer.rs index 12d404f..04c894f 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -80,6 +80,22 @@ impl Default for ByteBuf { } } +impl Clone for ByteBuf { + fn clone(&self) -> Self { + Self { inner: self.inner.clone() } + } +} + +impl Copy for ByteBuf {} + +impl PartialEq for ByteBuf { + fn eq(&self, other: &Self) -> bool { + self.inner == other.inner + } +} + +impl Eq for ByteBuf {} + /// A shortcut to create a stack allocated fixed size [ByteBuf](ByteBuf) pub type StaticByteBuf = ByteBuf<[u8; N]>;