Struct identity_iota::account::AccountBuilder
source · [−]account
only.Expand description
An Account
builder for easy account configuration.
To reduce memory usage, accounts created from the same builder share the same Storage
used to store identities, and the same Client
used to publish identities to the Tangle.
The configuration on the other hand is cloned, and therefore unique for each built account. This means a builder can be reconfigured in-between account creations, without affecting the configuration of previously built accounts.
Implementations
sourceimpl<C> AccountBuilder<C> where
C: SharedPtr<Client>,
impl<C> AccountBuilder<C> where
C: SharedPtr<Client>,
sourcepub fn new() -> AccountBuilder<C>
pub fn new() -> AccountBuilder<C>
Creates a new AccountBuilder
.
sourcepub fn autosave(self, value: AutoSave) -> AccountBuilder<C>
pub fn autosave(self, value: AutoSave) -> AccountBuilder<C>
Sets the account auto-save behaviour.
sourcepub fn autopublish(self, value: bool) -> AccountBuilder<C>
pub fn autopublish(self, value: bool) -> AccountBuilder<C>
Sets the account auto-publish behaviour.
sourcepub fn storage<S>(self, value: S) -> AccountBuilder<C> where
S: 'static + Storage,
pub fn storage<S>(self, value: S) -> AccountBuilder<C> where
S: 'static + Storage,
Sets the account storage adapter.
Sets the account storage adapter from a shared pointer.
sourcepub fn client(self, client: C) -> AccountBuilder<C>
pub fn client(self, client: C) -> AccountBuilder<C>
Sets the IOTA Tangle Client
, this determines the Network
used by the identity.
Accounts
created by the same AccountBuilder
will share the same Client
.
NOTE: this overwrites any ClientBuilder
previously set by
AccountBuilder::client_builder
.
sourcepub fn client_builder(self, client_builder: ClientBuilder) -> AccountBuilder<C>
pub fn client_builder(self, client_builder: ClientBuilder) -> AccountBuilder<C>
Sets the IOTA Tangle Client
, this determines the Network
used by the identity.
Accounts
created by the same AccountBuilder
will share the same Client
.
NOTE: this overwrites any Client
previously set by AccountBuilder::client
.
sourcepub async fn create_identity(
&mut self,
input: IdentitySetup
) -> Result<Account<C>, Error>
pub async fn create_identity(
&mut self,
input: IdentitySetup
) -> Result<Account<C>, Error>
Creates a new identity based on the builder configuration and returns
an Account
instance to manage it.
The identity is stored locally in the Storage
. The DID network is automatically determined
by the Client
used to publish it.
See IdentitySetup
to customize the identity creation.
Trait Implementations
sourceimpl<C> Default for AccountBuilder<C> where
C: SharedPtr<Client>,
impl<C> Default for AccountBuilder<C> where
C: SharedPtr<Client>,
sourcefn default() -> AccountBuilder<C>
fn default() -> AccountBuilder<C>
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl<C = Arc<Client>> !RefUnwindSafe for AccountBuilder<C>
impl<C> Send for AccountBuilder<C> where
C: Send,
impl<C> Sync for AccountBuilder<C> where
C: Sync,
impl<C> Unpin for AccountBuilder<C> where
C: Unpin,
impl<C = Arc<Client>> !UnwindSafe for AccountBuilder<C>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more