pub struct DecoderRegistry { /* private fields */ }Expand description
An ordered set of decoders. The first decoder whose matches returns true
wins; RawDecoder is always last and matches everything.
Implementations§
Source§impl DecoderRegistry
impl DecoderRegistry
Sourcepub fn with_builtins() -> Self
pub fn with_builtins() -> Self
The registry with all built-in decoders: PFS node, PFS session, then the raw fallback.
Sourcepub fn register(&mut self, d: Box<dyn PartitionDecoder>)
pub fn register(&mut self, d: Box<dyn PartitionDecoder>)
Insert a decoder ahead of the raw fallback.
Sourcepub fn decode(&self, meta: &PartitionMeta<'_>, data: &[u8]) -> Decoded
pub fn decode(&self, meta: &PartitionMeta<'_>, data: &[u8]) -> Decoded
Decode data, picking the first matching decoder.
Sourcepub fn decode_with(
&self,
name: &str,
meta: &PartitionMeta<'_>,
data: &[u8],
) -> Option<Decoded>
pub fn decode_with( &self, name: &str, meta: &PartitionMeta<'_>, data: &[u8], ) -> Option<Decoded>
Decode with a specific decoder by name, if present.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for DecoderRegistry
impl !Send for DecoderRegistry
impl !Sync for DecoderRegistry
impl !UnwindSafe for DecoderRegistry
impl Freeze for DecoderRegistry
impl Unpin for DecoderRegistry
impl UnsafeUnpin for DecoderRegistry
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