pub trait TryFromModule {
// Required method
fn try_from_module(
module: &Module,
) -> impl Future<Output = Result<Option<Self>>>
where Self: Sized;
// Provided methods
fn try_from_config(config: &Config) -> impl Future<Output = Result<Self>>
where Self: Sized { ... }
fn try_from_modules(
modules: &Vec<Module>,
) -> impl Future<Output = Result<Self>>
where Self: Sized { ... }
}Expand description
Creates a state from a config module. This is for a single state, which is required to be built. For multiple states see TryManyFromModule. This does not disallow for defining the module multiple times. In such a case the first module that is sorted into the Vec of the config or the provided Vec will be the winner.
Required Methods§
Sourcefn try_from_module(
module: &Module,
) -> impl Future<Output = Result<Option<Self>>>where
Self: Sized,
fn try_from_module(
module: &Module,
) -> impl Future<Output = Result<Option<Self>>>where
Self: Sized,
Builds the state from a module
§Return
- Option::None - if the module is not compatible with this state
- Option::Some - if the state could be built from the module
§Errors
- This might return an error if the module and state is compatible but the state still could not be built because of an actual error