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
impl ModuleDecoderRegistry
pub fn with_fallback(self) -> Self
pub fn decoding_mode(&self) -> DecodingMode
Sourcepub fn assert_reject_mode(&self)
pub fn assert_reject_mode(&self)
Panic if the Self::decoding_mode
is not Reject
Source§impl<M: Debug, State> ModuleRegistry<M, State>
impl<M: Debug, State> ModuleRegistry<M, State>
Sourcepub fn get_expect(&self, id: ModuleInstanceId) -> &M
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
Sourcepub fn register_module(
&mut self,
id: ModuleInstanceId,
kind: ModuleKind,
module: M,
)
pub fn register_module( &mut self, id: ModuleInstanceId, kind: ModuleKind, module: M, )
Add a module to the registry
pub fn append_module(&mut self, kind: ModuleKind, module: M)
Source§impl<M, State> ModuleRegistry<M, State>
impl<M, State> ModuleRegistry<M, State>
Sourcepub fn new(
iter: impl IntoIterator<Item = (ModuleInstanceId, ModuleKind, M)>,
) -> Selfwhere
State: Default,
pub fn new(
iter: impl IntoIterator<Item = (ModuleInstanceId, ModuleKind, M)>,
) -> Selfwhere
State: Default,
Create Self
from an iterator of pairs
Sourcepub fn iter_modules(
&self,
) -> impl Iterator<Item = (ModuleInstanceId, &ModuleKind, &M)>
pub fn iter_modules( &self, ) -> impl Iterator<Item = (ModuleInstanceId, &ModuleKind, &M)>
Return an iterator over all module data
Sourcepub fn iter_modules_id_kind(
&self,
) -> impl Iterator<Item = (ModuleInstanceId, &ModuleKind)>
pub fn iter_modules_id_kind( &self, ) -> impl Iterator<Item = (ModuleInstanceId, &ModuleKind)>
Return an iterator over module ids an kinds
Sourcepub fn iter_modules_mut(
&mut self,
) -> impl Iterator<Item = (ModuleInstanceId, &ModuleKind, &mut M)>
pub fn iter_modules_mut( &mut self, ) -> impl Iterator<Item = (ModuleInstanceId, &ModuleKind, &mut M)>
Return an iterator over all module data
Sourcepub fn into_iter_modules(
self,
) -> impl Iterator<Item = (ModuleInstanceId, ModuleKind, M)>
pub fn into_iter_modules( self, ) -> impl Iterator<Item = (ModuleInstanceId, ModuleKind, M)>
Return an iterator over all module data
Sourcepub fn get(&self, id: ModuleInstanceId) -> Option<&M>
pub fn get(&self, id: ModuleInstanceId) -> Option<&M>
Get module data by instance id
Sourcepub fn get_with_kind(&self, id: ModuleInstanceId) -> Option<&(ModuleKind, M)>
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>
impl<M, State> Clone for ModuleRegistry<M, State>
Source§impl<M, State> Default for ModuleRegistry<M, State>where
State: Default,
impl<M, State> Default for ModuleRegistry<M, State>where
State: Default,
Source§impl<M, State> From<BTreeMap<u16, (ModuleKind, M)>> for ModuleRegistry<M, State>where
State: Default,
impl<M, State> From<BTreeMap<u16, (ModuleKind, M)>> for ModuleRegistry<M, State>where
State: Default,
Source§fn from(value: BTreeMap<ModuleInstanceId, (ModuleKind, M)>) -> Self
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,
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
fn from_iter<T: IntoIterator<Item = (ModuleInstanceId, ModuleKind, M)>>( iter: T, ) -> Self
Creates a value from an iterator. Read more