pub struct OlmMachineBuilder { /* private fields */ }Expand description
A builder object to help creating an OlmMachine instance.
Implementations§
Source§impl OlmMachineBuilder
impl OlmMachineBuilder
Sourcepub fn new(user_id: &UserId, device_id: &DeviceId) -> Self
pub fn new(user_id: &UserId, device_id: &DeviceId) -> Self
Create a new OlmMachineBuilder which will create an OlmMachine
belonging to the given user id / device id.
Sourcepub fn with_crypto_store(self, store: impl IntoCryptoStore) -> Self
pub fn with_crypto_store(self, store: impl IntoCryptoStore) -> Self
Set the CryptoStore implementation that will be used to store
the encryption keys.
If this is not populated before OlmMachineBuilder::build is called,
a new MemoryStore will be created.
Sourcepub fn with_custom_account(self, custom_account: Option<Account>) -> Self
pub fn with_custom_account(self, custom_account: Option<Account>) -> Self
Set a custom vodozemac::olm::Account to be used for the identity and
one-time keys of this OlmMachine. If this is not set before
OlmMachineBuilder::build is called, a new default one or one
from the store will be used.
If an account is provided and one already exists in the store for this
UserId/DeviceId combination, an error will be raised. This is
useful if one wishes to create identity keys before knowing the
user/device IDs, e.g., to use the identity key as the device ID.
Sourcepub async fn build(self) -> Result<OlmMachine, CryptoStoreError>
pub async fn build(self) -> Result<OlmMachine, CryptoStoreError>
Construct a new OlmMachine from this builder.
If a store was given via OlmMachineBuilder::with_crypto_store, and
the store already contains encryption keys for the given user/device
pair, those will be re-used. Otherwise new device keys will be created
and stored.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OlmMachineBuilder
impl !RefUnwindSafe for OlmMachineBuilder
impl Send for OlmMachineBuilder
impl Sync for OlmMachineBuilder
impl Unpin for OlmMachineBuilder
impl UnsafeUnpin for OlmMachineBuilder
impl !UnwindSafe for OlmMachineBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CompatExt for T
impl<T> CompatExt for T
Source§impl<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
Source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more