#[derive(FromClient)]Expand description
Derive macro for implementing the FromClient trait on client structs.
This macro generates an implementation of the FromClient trait that extracts
all struct fields from a Client using the FromClientPart trait.
§Example
ⓘ
use bitwarden_core::client::FromClient;
use bitwarden_core_macro::FromClient;
#[derive(FromClient)]
pub struct FoldersClient {
key_store: KeyStore<KeySlotIds>,
api_configurations: Arc<ApiConfigurations>,
repository: Option<Arc<dyn Repository<Folder>>>,
}The macro generates:
ⓘ
impl FromClient for FoldersClient {
fn from_client(client: &Client) -> Self {
Self {
key_store: FromClientPart::<KeyStore<KeySlotIds>>::get_part(client),
api_configs: FromClientPart::<Arc<ApiConfigurations>>::get_part(client),
repository: FromClientPart::<Option<Arc<dyn Repository<Folder>>>>::get_part(client),
}
}
}