Trait sandkiste::Module

source ·
pub trait Module<'a, 'b>: Sized {
    type Machine: Machine<'a>;

    // Required methods
    fn module(&self, name: &str) -> Result<Self, MachineError>;
    fn get(
        &self,
        name: &str
    ) -> Result<<Self::Machine as Machine<'a>>::Datum<'b, 'static>, MachineError>;
    fn set<'c>(
        &self,
        name: &str,
        datum: <Self::Machine as Machine<'a>>::Datum<'b, 'c>
    ) -> Result<(), MachineError>;
}
Expand description

Module of Machine where values can be read and set (access with HasModules::module)

Required Associated Types§

source

type Machine: Machine<'a>

Machine type which the module belongs to

Required Methods§

source

fn module(&self, name: &str) -> Result<Self, MachineError>

Open a sub-module (create if non-existent)

source

fn get( &self, name: &str ) -> Result<<Self::Machine as Machine<'a>>::Datum<'b, 'static>, MachineError>

Get value from module

source

fn set<'c>( &self, name: &str, datum: <Self::Machine as Machine<'a>>::Datum<'b, 'c> ) -> Result<(), MachineError>

Set value in module

Implementors§