pub struct Config { /* private fields */ }
Expand description
Serialization and deserialization configuration.
Implementations§
source§impl Config
impl Config
sourcepub const fn allocation_budget(self, budget: usize) -> Self
pub const fn allocation_budget(self, budget: usize) -> Self
Sets the maximum number of bytes able to be allocated. This is not guaranteed to be perfectly accurate, due to the limitations of serde deserializers. Pot can keep track of how many bytes it thinks its allocating, but a deserializer can always allocate more memory than Pot can be aware of.
The default allocation budget is usize::MAX
.
sourcepub const fn compatibility(self, compatibilty: Compatibility) -> Self
pub const fn compatibility(self, compatibilty: Compatibility) -> Self
Sets the compatibility mode for serializing and returns self.
sourcepub fn deserialize<'de, T>(&self, serialized: &'de [u8]) -> Result<T>where
T: Deserialize<'de>,
pub fn deserialize<'de, T>(&self, serialized: &'de [u8]) -> Result<T>where
T: Deserialize<'de>,
Deserializes a value from a slice using the configured options.
sourcepub fn deserialize_from<T, R: Read>(&self, reader: R) -> Result<T>where
T: DeserializeOwned,
pub fn deserialize_from<T, R: Read>(&self, reader: R) -> Result<T>where
T: DeserializeOwned,
Deserializes a value from a Read
implementer using the configured
options.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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