Type Alias ModuleDecoderRegistry

Source
pub type ModuleDecoderRegistry = ModuleRegistry<Decoder, DecodingMode>;
Expand description

Collection of decoders belonging to modules, typically obtained from a ModuleRegistry

Aliased Type§

struct ModuleDecoderRegistry {
    inner: BTreeMap<u16, (ModuleKind, Decoder)>,
    state: DecodingMode,
}

Fields§

§inner: BTreeMap<u16, (ModuleKind, Decoder)>§state: DecodingMode

Implementations§

Source§

impl ModuleDecoderRegistry

Source

pub fn with_fallback(self) -> Self

Source

pub fn decoding_mode(&self) -> DecodingMode

Source

pub fn assert_reject_mode(&self)

Panic if the Self::decoding_mode is not Reject

Source§

impl<M: Debug, State> ModuleRegistry<M, State>

Source

pub fn get_expect(&self, id: ModuleInstanceId) -> &M

Return the module data belonging to the module identified by the supplied module_id

§Panics

If the module isn’t in the registry

Source

pub fn register_module( &mut self, id: ModuleInstanceId, kind: ModuleKind, module: M, )

Add a module to the registry

Source

pub fn append_module(&mut self, kind: ModuleKind, module: M)

Source§

impl<M, State> ModuleRegistry<M, State>

Source

pub fn new( iter: impl IntoIterator<Item = (ModuleInstanceId, ModuleKind, M)>, ) -> Self
where State: Default,

Create Self from an iterator of pairs

Source

pub fn is_empty(&self) -> bool

Is registry empty?

Source

pub fn iter_modules( &self, ) -> impl Iterator<Item = (ModuleInstanceId, &ModuleKind, &M)>

Return an iterator over all module data

Source

pub fn iter_modules_id_kind( &self, ) -> impl Iterator<Item = (ModuleInstanceId, &ModuleKind)>

Return an iterator over module ids an kinds

Source

pub fn iter_modules_mut( &mut self, ) -> impl Iterator<Item = (ModuleInstanceId, &ModuleKind, &mut M)>

Return an iterator over all module data

Source

pub fn into_iter_modules( self, ) -> impl Iterator<Item = (ModuleInstanceId, ModuleKind, M)>

Return an iterator over all module data

Source

pub fn get(&self, id: ModuleInstanceId) -> Option<&M>

Get module data by instance id

Source

pub fn get_with_kind(&self, id: ModuleInstanceId) -> Option<&(ModuleKind, M)>

Get module data by instance id, including ModuleKind

Trait Implementations

Source§

impl<M, State> Clone for ModuleRegistry<M, State>
where State: Clone, M: Clone,

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<M: Debug, State: Debug> Debug for ModuleRegistry<M, State>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<M, State> Default for ModuleRegistry<M, State>
where State: Default,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<M, State> From<BTreeMap<u16, (ModuleKind, M)>> for ModuleRegistry<M, State>
where State: Default,

Source§

fn from(value: BTreeMap<ModuleInstanceId, (ModuleKind, M)>) -> Self

Converts to this type from the input type.
Source§

impl<M, State> FromIterator<(u16, ModuleKind, M)> for ModuleRegistry<M, State>
where State: Default,

Source§

fn from_iter<T: IntoIterator<Item = (ModuleInstanceId, ModuleKind, M)>>( iter: T, ) -> Self

Creates a value from an iterator. Read more