Skip to content

Commit

Permalink
Debug for ByteChunk
Browse files Browse the repository at this point in the history
  • Loading branch information
TimLuq committed Aug 4, 2024
1 parent 388eca2 commit 77c112a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "bytedata"
version = "0.1.7"
edition = "2021"
rust-version = "1.75.0"
rust-version = "1.75"
description = "Representation of a byte slice that is either static, borrowed, or shared."
license = "MIT OR LGPL-3.0-or-later"
repository = "https://github.com/TimLuq/bytedata/"
Expand Down
7 changes: 7 additions & 0 deletions src/byte_chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,10 @@ impl Default for ByteChunk {
unsafe { core::mem::zeroed() }
}
}

impl core::fmt::Debug for ByteChunk {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let rend = crate::ByteStringRender::from_slice(self.as_slice());
core::fmt::Debug::fmt(&rend, f)
}
}
3 changes: 2 additions & 1 deletion src/external.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ impl ExtBytes {
(header, len, ptr)
};

let data = alloc::boxed::Box::into_raw(alloc::boxed::Box::new(ExtBytesRef { data, ptr, len }));
let data =
alloc::boxed::Box::into_raw(alloc::boxed::Box::new(ExtBytesRef { data, ptr, len }));

crate::ByteData {
external: core::mem::ManuallyDrop::new(ExtBytes {
Expand Down

0 comments on commit 77c112a

Please sign in to comment.