pub struct Deserializer<'input> { /* private fields */ }Expand description
Builder-style postcard deserializer.
This single API supports all current entry points:
typed owned/borrowed deserialization, shape-based value deserialization,
and deserialization into existing Partial values.
Implementations§
Source§impl<'input> Deserializer<'input>
impl<'input> Deserializer<'input>
Sourcepub const fn new(input: &'input [u8]) -> Self
pub const fn new(input: &'input [u8]) -> Self
Create a deserializer for a postcard byte slice with default settings.
Sourcepub const fn with_config(input: &'input [u8], config: DeserializeConfig) -> Self
pub const fn with_config(input: &'input [u8], config: DeserializeConfig) -> Self
Create a deserializer with explicit settings.
Sourcepub const fn config(self, config: DeserializeConfig) -> Self
pub const fn config(self, config: DeserializeConfig) -> Self
Replace all deserialization settings.
Sourcepub const fn max_collection_elements(self, max_collection_elements: u64) -> Self
pub const fn max_collection_elements(self, max_collection_elements: u64) -> Self
Configure the maximum collection element count.
Sourcepub fn deserialize<T>(self) -> Result<T, DeserializeError>where
T: Facet<'static>,
pub fn deserialize<T>(self) -> Result<T, DeserializeError>where
T: Facet<'static>,
Deserialize into an owned typed value.
Sourcepub fn deserialize_borrowed<'facet, T>(self) -> Result<T, DeserializeError>where
T: Facet<'facet>,
'input: 'facet,
pub fn deserialize_borrowed<'facet, T>(self) -> Result<T, DeserializeError>where
T: Facet<'facet>,
'input: 'facet,
Deserialize into a borrowed typed value.
Sourcepub fn deserialize_with_shape(
self,
source_shape: &'static Shape,
) -> Result<Value, DeserializeError>
pub fn deserialize_with_shape( self, source_shape: &'static Shape, ) -> Result<Value, DeserializeError>
Deserialize into a dynamic Value using a runtime shape.
Sourcepub fn deserialize_into<'facet>(
self,
partial: Partial<'facet, false>,
) -> Result<Partial<'facet, false>, DeserializeError>
pub fn deserialize_into<'facet>( self, partial: Partial<'facet, false>, ) -> Result<Partial<'facet, false>, DeserializeError>
Deserialize into an existing owned Partial.
Sourcepub fn deserialize_into_borrowed<'facet>(
self,
partial: Partial<'facet, true>,
) -> Result<Partial<'facet, true>, DeserializeError>where
'input: 'facet,
pub fn deserialize_into_borrowed<'facet>(
self,
partial: Partial<'facet, true>,
) -> Result<Partial<'facet, true>, DeserializeError>where
'input: 'facet,
Deserialize into an existing borrowed Partial.
Trait Implementations§
Source§impl<'input> Clone for Deserializer<'input>
impl<'input> Clone for Deserializer<'input>
Source§fn clone(&self) -> Deserializer<'input>
fn clone(&self) -> Deserializer<'input>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'input> Debug for Deserializer<'input>
impl<'input> Debug for Deserializer<'input>
impl<'input> Copy for Deserializer<'input>
Auto Trait Implementations§
impl<'input> Freeze for Deserializer<'input>
impl<'input> RefUnwindSafe for Deserializer<'input>
impl<'input> Send for Deserializer<'input>
impl<'input> Sync for Deserializer<'input>
impl<'input> Unpin for Deserializer<'input>
impl<'input> UnsafeUnpin for Deserializer<'input>
impl<'input> UnwindSafe for Deserializer<'input>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more