diff --git a/Cargo.toml b/Cargo.toml index bbdc1de..14d7733 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bipack_ru" -version = "0.4.3" +version = "0.4.4" edition = "2021" license = "Apache-2.0" description = "binary size-effective format used in Divan smart contracts, wasm bindings, network protocols, etc." diff --git a/src/de.rs b/src/de.rs index ff88dbb..d02a7de 100644 --- a/src/de.rs +++ b/src/de.rs @@ -269,7 +269,7 @@ mod tests { use crate::de::from_bytes; use crate::error::Result; use crate::ser::{to_buffer, to_bytes}; - use crate::tools::{to_dump}; + use crate::tools::{to_dump, ToDump}; #[test] fn test_ints() -> Result<()> { @@ -434,4 +434,11 @@ mod tests { assert_eq!(7, packed.len()); } + #[test] + fn test_str() { + let src = "hello"; + let x = to_bytes(src); + println!("{}", x.unwrap().to_dump()); + } + } \ No newline at end of file diff --git a/src/ser.rs b/src/ser.rs index 80f058d..1a637cd 100644 --- a/src/ser.rs +++ b/src/ser.rs @@ -11,7 +11,7 @@ pub struct Serializer { } pub fn to_bytes(value: &T) -> Result> - where T: Serialize, + where T: Serialize + ?Sized, { let mut serializer = Serializer { output: Vec::new() }; value.serialize(&mut serializer)?;