pub struct Config { /* private fields */ }
Expand description
Serialization and deserialization configuration.
Implementations
sourceimpl 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 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
implementor using the configured
options.
sourcepub fn serialize<T: Serialize>(&self, value: &T) -> Result<Vec<u8>>
pub fn serialize<T: Serialize>(&self, value: &T) -> Result<Vec<u8>>
Serializes a value to a Vec
using the configured options.
sourcepub fn serialize_into<T, W>(&self, value: &T, writer: W) -> Result<()> where
T: Serialize,
W: WriteBytesExt,
pub fn serialize_into<T, W>(&self, value: &T, writer: W) -> Result<()> where
T: Serialize,
W: WriteBytesExt,
Serializes a value to a writer using the configured options.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more