diff --git a/src/de.rs b/src/de.rs index 08534a2..b385bcf 100644 --- a/src/de.rs +++ b/src/de.rs @@ -138,7 +138,7 @@ where } /// Deserialization implementation for BCS -struct Deserializer { +pub struct Deserializer { input: R, max_remaining_depth: usize, } @@ -155,7 +155,7 @@ impl<'de, R: Read> Deserializer> { impl<'de> Deserializer<&'de [u8]> { /// Creates a new `Deserializer` which will be deserializing the provided /// input. - fn new(input: &'de [u8], max_remaining_depth: usize) -> Self { + pub fn new(input: &'de [u8], max_remaining_depth: usize) -> Self { Deserializer { input, max_remaining_depth, diff --git a/src/lib.rs b/src/lib.rs index 4ede21a..9fe4e8c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -315,11 +315,13 @@ pub const MAX_SEQUENCE_LENGTH: usize = (1 << 31) - 1; pub const MAX_CONTAINER_DEPTH: usize = 500; pub use de::{ + Deserializer, from_bytes, from_bytes_seed, from_bytes_seed_with_limit, from_bytes_with_limit, from_reader, from_reader_seed, from_reader_seed_with_limit, from_reader_with_limit, }; pub use error::{Error, Result}; pub use ser::{ + Serializer, is_human_readable, serialize_into, serialize_into_with_limit, serialized_size, serialized_size_with_limit, to_bytes, to_bytes_with_limit, }; diff --git a/src/ser.rs b/src/ser.rs index 9bd42ce..0e05cde 100644 --- a/src/ser.rs +++ b/src/ser.rs @@ -140,7 +140,7 @@ pub fn is_human_readable() -> bool { } /// Serialization implementation for BCS -struct Serializer<'a, W: ?Sized> { +pub struct Serializer<'a, W: ?Sized> { output: &'a mut W, max_remaining_depth: usize, } @@ -150,7 +150,7 @@ where W: ?Sized + std::io::Write, { /// Creates a new `Serializer` which will emit BCS. - fn new(output: &'a mut W, max_remaining_depth: usize) -> Self { + pub fn new(output: &'a mut W, max_remaining_depth: usize) -> Self { Self { output, max_remaining_depth, @@ -479,8 +479,7 @@ where } } -#[doc(hidden)] -struct MapSerializer<'a, W: ?Sized> { +pub struct MapSerializer<'a, W: ?Sized> { serializer: Serializer<'a, W>, entries: Vec<(Vec, Vec)>, next_key: Option>,