allow packing &str
This commit is contained in:
parent
ad32bbe26e
commit
94c91e788e
@ -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."
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
@ -11,7 +11,7 @@ pub struct Serializer<S: BipackSink> {
|
||||
}
|
||||
|
||||
pub fn to_bytes<T>(value: &T) -> Result<Vec<u8>>
|
||||
where T: Serialize,
|
||||
where T: Serialize + ?Sized,
|
||||
{
|
||||
let mut serializer = Serializer { output: Vec::new() };
|
||||
value.serialize(&mut serializer)?;
|
||||
|
Loading…
Reference in New Issue
Block a user