Type Alias ServerModuleConfigGenParamsRegistry

Source
pub type ServerModuleConfigGenParamsRegistry = ModuleRegistry<ConfigGenModuleParams>;
Expand description

Registry that contains the config gen params for all modules

Aliased Type§

struct ServerModuleConfigGenParamsRegistry {
    inner: BTreeMap<u16, (ModuleKind, ConfigGenModuleParams)>,
    state: (),
}

Fields§

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

Implementations

Source§

impl ModuleRegistry<ConfigGenModuleParams>

Source

pub fn attach_config_gen_params_by_id<T: ModuleInitParams>( &mut self, id: ModuleInstanceId, kind: ModuleKind, gen: T, ) -> &mut Self

Source

pub fn attach_config_gen_params<T: ModuleInitParams>( &mut self, kind: ModuleKind, gen: T, ) -> &mut Self

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<'de> Deserialize<'de> for ServerModuleConfigGenParamsRegistry

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ServerModuleConfigGenParamsRegistry

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ServerModuleConfigGenParamsRegistry

Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for ServerModuleConfigGenParamsRegistry

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