Skip to main content

DecodeWith

Trait DecodeWith 

Source
pub trait DecodeWith<A>: Sized {
    // Required method
    fn decode_with<S: Source>(r: &mut S, args: A) -> Result<Self, BitError>;
}
Expand description

Polymorphic decode with context A — the companion to a #[bin(ctx(...))] type’s inherent decode_with, for hand-written generic combinators and trait-object parsing (ctx Layer 2). Every BitDecode type is DecodeWith<()> (blanket), and a ctx type is DecodeWith<…Ctx>, so one bound T: DecodeWith<A> spans both context-free and context-taking messages. Inherent Type::decode_with call sites are unaffected.

Required Methods§

Source

fn decode_with<S: Source>(r: &mut S, args: A) -> Result<Self, BitError>

Decodes Self from a Source given args.

§Errors

Propagates the decode BitError.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§