pub struct Codec<Opts>(/* private fields */);Expand description
Bincode codec with opinionated settings.
Implementations§
Source§impl<Opts: Options> Codec<Opts>
impl<Opts: Options> Codec<Opts>
Sourcepub fn with_limit(self, max: u64) -> Codec<WithOtherLimit<Opts, Bounded>>
pub fn with_limit(self, max: u64) -> Codec<WithOtherLimit<Opts, Bounded>>
Impose a limit on encoding / decoding size.
Sourcepub fn serialize_into<W, T>(self, writer: W, item: &T) -> Result<()>
pub fn serialize_into<W, T>(self, writer: W, item: &T) -> Result<()>
Encode an object into a writer.
Sourcepub fn deserialize<'a, T>(self, bytes: &'a [u8]) -> Result<T>where
T: Deserialize<'a>,
pub fn deserialize<'a, T>(self, bytes: &'a [u8]) -> Result<T>where
T: Deserialize<'a>,
Decode an object from a slice.
Sourcepub fn deserialize_from<T, R>(self, reader: R) -> Result<T>where
T: DeserializeOwned,
R: Read,
pub fn deserialize_from<T, R>(self, reader: R) -> Result<T>where
T: DeserializeOwned,
R: Read,
Decode an object from a reader.
Trait Implementations§
Auto Trait Implementations§
impl<Opts> Freeze for Codec<Opts>where
Opts: Freeze,
impl<Opts> RefUnwindSafe for Codec<Opts>where
Opts: RefUnwindSafe,
impl<Opts> Send for Codec<Opts>where
Opts: Send,
impl<Opts> Sync for Codec<Opts>where
Opts: Sync,
impl<Opts> Unpin for Codec<Opts>where
Opts: Unpin,
impl<Opts> UnsafeUnpin for Codec<Opts>where
Opts: UnsafeUnpin,
impl<Opts> UnwindSafe for Codec<Opts>where
Opts: UnwindSafe,
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