pub trait FromClient: Sized {
// Required method
fn from_client(client: &Client) -> Result<Self, String>;
}Expand description
Trait for types that can be constructed from a Client.
This trait is typically derived using #[derive(FromClient)] from
the bitwarden_core_macro crate, which generates the implementation
by extracting all struct fields from the Client using FromClientPart.
§Example
ⓘ
use bitwarden_core::client::FromClient;
use bitwarden_core_macro::FromClient;
#[derive(FromClient)]
pub struct FoldersClient {
key_store: KeyStore<KeyIds>,
api_configurations: Arc<ApiConfigurations>,
repository: Arc<dyn Repository<Folder>>,
}
// Usage:
let folders_client = FoldersClient::from_client(&client)?;Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.