deltachat::accounts

Struct Config

source
struct Config {
    file: PathBuf,
    inner: InnerConfig,
    lock_task: Option<JoinHandle<Result<()>>>,
}
Expand description

Account manager configuration file.

Fields§

§file: PathBuf§inner: InnerConfig§lock_task: Option<JoinHandle<Result<()>>>

Implementations§

source§

impl Config

source

async fn create_lock_task( dir: PathBuf, ) -> Result<Option<JoinHandle<Result<()>>>>

source

async fn new_nosync(file: PathBuf, lock: bool) -> Result<Self>

Creates a new Config for file, but doesn’t open/sync it.

source

pub async fn new(dir: &Path) -> Result<Self>

Creates a new configuration file in the given account manager directory.

source

async fn sync(&mut self) -> Result<()>

Sync the inmemory representation to disk. Takes a mutable reference because the saved file is a part of the Config state. This protects from parallel calls resulting to a wrong file contents.

source

pub async fn from_file(file: PathBuf, writable: bool) -> Result<Self>

Read a configuration from the given file into memory.

source

pub async fn load_accounts( &self, events: &Events, stockstrings: &StockStrings, push_subscriber: PushSubscriber, dir: &Path, ) -> Result<BTreeMap<u32, Context>>

Loads all accounts defined in the configuration file.

Created contexts share the same event channel and stock string translations.

source

async fn new_account(&mut self) -> Result<AccountConfig>

Creates a new account in the account manager directory.

source

pub async fn remove_account(&mut self, id: u32) -> Result<()>

Removes an existing account entirely.

source

fn get_account(&self, id: u32) -> Option<AccountConfig>

Returns configuration file section for the given account ID.

source

pub fn get_selected_account(&self) -> u32

Returns the ID of selected account.

source

pub async fn select_account(&mut self, id: u32) -> Result<()>

Changes selected account ID.

Trait Implementations§

source§

impl Debug for Config

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for Config

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T