Type Alias ServerModuleRegistry

Source
pub type ServerModuleRegistry = ModuleRegistry<DynServerModule>;
Expand description

Collection of server modules

Aliased Type§

struct ServerModuleRegistry { /* private fields */ }

Implementations

Source§

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

Source

pub fn get_expect(&self, id: u16) -> &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: u16, 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 = (u16, ModuleKind, M)>, ) -> ModuleRegistry<M, State>
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 = (u16, &ModuleKind, &M)>

Return an iterator over all module data

Source

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

Return an iterator over module ids an kinds

Source

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

Return an iterator over all module data

Source

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

Return an iterator over all module data

Source

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

Get module data by instance id

Source

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

Get module data by instance id, including ModuleKind

Trait Implementations§

Source§

impl ServerModuleRegistryExt for ServerModuleRegistry

Source§

fn decoder_registry(&self) -> ModuleDecoderRegistry

Generate a ModuleDecoderRegistry from this ModuleRegistry

Source§

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

Source§

fn clone(&self) -> ModuleRegistry<M, State>

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, State> Debug for ModuleRegistry<M, State>
where M: Debug, State: Debug,

Source§

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

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

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

Source§

fn default() -> ModuleRegistry<M, State>

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<u16, (ModuleKind, M)>) -> ModuleRegistry<M, State>

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>(iter: T) -> ModuleRegistry<M, State>
where T: IntoIterator<Item = (u16, ModuleKind, M)>,

Creates a value from an iterator. Read more