#[derive(FromResources)]
{
// Attributes available to this derive:
#[res]
#[from_resources]
}
Expand description
Derive a from_resources(&Resources<_>) -> CanoResult<Self> constructor that
pulls each field out of a cano::Resources map.
Each field must be Arc<T>. Use #[res("key")] for string-literal lookups
or #[res(EnumType::Variant)] for enum-path lookups. Use
#[from_resources(key = MyType)] on the struct to override the inferred key type.
§Example
ⓘ
use cano::prelude::*;
use std::sync::Arc;
#[derive(FromResources)]
struct Deps {
#[res("store")]
store: Arc<MemoryStore>,
}