Skip to content

Commit

Permalink
Fixed missing trait implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuri6037 committed Nov 21, 2023
1 parent 8465aee commit bf0051d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bytesutil"
version = "0.1.0"
version = "0.2.0"
authors = ["Yuri Edward <yuri6037@outlook.com>"]
edition = "2021"
description = "Yet another byte utility for Rust"
Expand Down
7 changes: 3 additions & 4 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 16 additions & 0 deletions src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,22 @@ impl<T: Default> Default for ByteBuf<T> {
}
}

impl<T: Clone> Clone for ByteBuf<T> {
fn clone(&self) -> Self {
Self { inner: self.inner.clone() }
}
}

impl<T: Copy> Copy for ByteBuf<T> {}

impl<T: PartialEq> PartialEq for ByteBuf<T> {
fn eq(&self, other: &Self) -> bool {
self.inner == other.inner
}
}

impl<T: Eq> Eq for ByteBuf<T> {}

/// A shortcut to create a stack allocated fixed size [ByteBuf](ByteBuf)
pub type StaticByteBuf<const N: usize> = ByteBuf<[u8; N]>;

Expand Down

0 comments on commit bf0051d

Please sign in to comment.