Struct deltachat::context::Context

source ·
pub struct Context {
    pub(crate) inner: Arc<InnerContext>,
}
Expand description

The context for a single DeltaChat account.

This contains all the state for a single DeltaChat account, including background tasks running in Tokio to operate the account. The Context can be cheaply cloned.

Each context, and thus each account, must be associated with an directory where all the state is kept. This state is also preserved between restarts.

To use multiple accounts it is best to look at the accounts manager which handles storing multiple accounts in a single directory structure and handles loading them all concurrently.

Fields§

§inner: Arc<InnerContext>

Implementations§

source§

impl Context

source

pub fn set_last_error(&self, error: &str)

Set last error string. Implemented as blocking as used from macros in different, not always async blocks.

source

pub fn get_last_error(&self) -> String

Get last error string.

source§

impl Context

source

pub(crate) async fn sync_alter_chat( &self, id: &SyncId, action: &SyncAction, ) -> Result<()>

Executes SyncData::AlterChat item sent by other device.

source

pub(crate) fn on_archived_chats_maybe_noticed(&self)

Emits the appropriate MsgsChanged event. Should be called if the number of unnoticed archived chats could decrease. In general we don’t want to make an extra db query to know if a noticied chat is archived. Emitting events should be cheap, a false-positive MsgsChanged is ok.

source§

impl Context

source

pub(crate) async fn config_exists(&self, key: Config) -> Result<bool>

Returns true if configuration value is set in the db for the given key.

NB: Don’t use this to check if the key is configured because this doesn’t look into environment. The proper use of this function is e.g. checking a key before setting it.

source

pub(crate) async fn get_config_opt(&self, key: Config) -> Result<Option<String>>

Get a config key value. Returns None if no value is set.

source

pub async fn get_config(&self, key: Config) -> Result<Option<String>>

Get a config key value if set, or a default value. Returns None if no value exists.

source

pub(crate) async fn get_config_opt_parsed<T: FromStr>( &self, key: Config, ) -> Result<Option<T>>

Returns Some(T) if a value for the given key is set and was successfully parsed. Returns None if could not parse.

source

pub async fn get_config_parsed<T: FromStr>( &self, key: Config, ) -> Result<Option<T>>

Returns Some(T) if a value for the given key exists (incl. default value) and was successfully parsed. Returns None if could not parse.

source

pub async fn get_config_int(&self, key: Config) -> Result<i32>

Returns 32-bit signed integer configuration value for the given key.

source

pub async fn get_config_u32(&self, key: Config) -> Result<u32>

Returns 32-bit unsigned integer configuration value for the given key.

source

pub async fn get_config_i64(&self, key: Config) -> Result<i64>

Returns 64-bit signed integer configuration value for the given key.

source

pub async fn get_config_u64(&self, key: Config) -> Result<u64>

Returns 64-bit unsigned integer configuration value for the given key.

source

pub(crate) async fn get_config_bool_opt( &self, key: Config, ) -> Result<Option<bool>>

Returns boolean configuration value (if set) for the given key.

source

pub async fn get_config_bool(&self, key: Config) -> Result<bool>

Returns boolean configuration value for the given key.

source

pub(crate) async fn should_watch_mvbox(&self) -> Result<bool>

Returns true if movebox (“DeltaChat” folder) should be watched.

source

pub(crate) async fn should_watch_sentbox(&self) -> Result<bool>

Returns true if sentbox (“Sent” folder) should be watched.

source

pub(crate) async fn should_send_sync_msgs(&self) -> Result<bool>

Returns true if sync messages should be sent.

source

pub(crate) async fn should_move_sync_msgs(&self) -> Result<bool>

Returns whether sync messages should be uploaded to the mvbox.

source

pub(crate) async fn should_request_mdns(&self) -> Result<bool>

Returns whether MDNs should be requested.

source

pub(crate) async fn should_send_mdns(&self) -> Result<bool>

Returns whether MDNs should be sent.

source

pub async fn get_config_delete_server_after(&self) -> Result<Option<i64>>

Gets configured “delete_server_after” value.

None means never delete the message, Some(0) means delete at once, Some(x) means delete after x seconds.

source

pub async fn get_configured_provider(&self) -> Result<Option<&'static Provider>>

Gets the configured provider, as saved in the configured_provider value.

The provider is determined by get_provider_info() during configuration and then saved to the db in param.save_to_database(), together with all the other configured_* values.

source

pub async fn get_config_delete_device_after(&self) -> Result<Option<i64>>

Gets configured “delete_device_after” value.

None means never delete the message, Some(x) means delete after x seconds.

source

pub(crate) async fn sync_config(&self, key: &Config, value: &str) -> Result<()>

Executes SyncData::Config item sent by other device.

source

fn check_config(key: Config, value: Option<&str>) -> Result<()>

source

pub async fn set_config(&self, key: Config, value: Option<&str>) -> Result<()>

Set the given config key and make it effective. This may restart the IO scheduler. If None is passed as a value the value is cleared and set to the default if there is one.

source

pub(crate) async fn set_config_internal( &self, key: Config, value: Option<&str>, ) -> Result<()>

source

pub(crate) async fn set_config_ex( &self, sync: Sync, key: Config, value: Option<&str>, ) -> Result<()>

source

pub async fn set_config_u32(&self, key: Config, value: u32) -> Result<()>

Set the given config to an unsigned 32-bit integer value.

source

pub async fn set_config_bool(&self, key: Config, value: bool) -> Result<()>

Set the given config to a boolean value.

source

pub async fn set_ui_config(&self, key: &str, value: Option<&str>) -> Result<()>

Sets an ui-specific key-value pair. Keys must be prefixed by ui. and should be followed by the name of the system and maybe subsystem, eg. ui.desktop.linux.foo, ui.desktop.macos.bar, ui.ios.foobar.

source

pub async fn get_ui_config(&self, key: &str) -> Result<Option<String>>

Gets an ui-specific value set by set_ui_config().

source§

impl Context

source

pub(crate) async fn is_self_addr(&self, addr: &str) -> Result<bool>

Determine whether the specified addr maps to the/a self addr. Returns false if no addresses are configured.

source

pub(crate) async fn set_primary_self_addr( &self, primary_new: &str, ) -> Result<()>

Sets primary_new as the new primary self address and saves the old primary address (if exists) as a secondary address.

This should only be used by test code and during configure.

source

pub(crate) async fn get_all_self_addrs(&self) -> Result<Vec<String>>

Returns all primary and secondary self addresses.

source

pub(crate) async fn get_secondary_self_addrs(&self) -> Result<Vec<String>>

Returns all secondary self addresses.

source

pub async fn get_primary_self_addr(&self) -> Result<String>

Returns the primary self address. Returns an error if no self addr is configured.

source§

impl Context

source

pub async fn is_configured(&self) -> Result<bool>

Checks if the context is already configured.

source

pub async fn configure(&self) -> Result<()>

Configures this account with the currently set parameters.

source

async fn inner_configure(&self) -> Result<()>

source§

impl Context

source

pub async fn new( dbfile: &Path, id: u32, events: Events, stock_strings: StockStrings, ) -> Result<Context>

Creates new context and opens the database.

source

pub async fn new_closed( dbfile: &Path, id: u32, events: Events, stockstrings: StockStrings, push_subscriber: PushSubscriber, ) -> Result<Context>

Creates new context without opening the database.

source

pub async fn open(&self, passphrase: String) -> Result<bool>

Opens the database with the given passphrase.

Returns true if passphrase is correct, false is passphrase is not correct. Fails on other errors.

source

pub async fn change_passphrase(&self, passphrase: String) -> Result<()>

Changes encrypted database passphrase.

source

pub async fn is_open(&self) -> bool

Returns true if database is open.

source

pub(crate) async fn check_passphrase(&self, passphrase: String) -> Result<bool>

Tests the database passphrase.

Returns true if passphrase is correct.

Fails if database is already open.

source

pub(crate) fn with_blobdir( dbfile: PathBuf, blobdir: PathBuf, id: u32, events: Events, stockstrings: StockStrings, push_subscriber: PushSubscriber, ) -> Result<Context>

source

pub async fn start_io(&self)

Starts the IO scheduler.

source

pub async fn stop_io(&self)

Stops the IO scheduler.

source

pub async fn restart_io_if_running(&self)

Restarts the IO scheduler if it was running before when it is not running this is an no-op

source

pub async fn maybe_network(&self)

Indicate that the network likely has come back.

source

pub async fn is_chatmail(&self) -> Result<bool>

Returns true if an account is on a chatmail server.

source

pub(crate) async fn get_max_smtp_rcpt_to(&self) -> Result<usize>

Returns maximum number of recipients the provider allows to send a single email to.

source

pub async fn background_fetch(&self) -> Result<()>

Does a single round of fetching from IMAP and returns.

Can be used even if I/O is currently stopped. If I/O is currently stopped, starts a new IMAP connection and fetches from Inbox and DeltaChat folders.

source

pub(crate) async fn schedule_resync(&self) -> Result<()>

source

pub fn get_dbfile(&self) -> &Path

Returns database file path.

source

pub fn get_blobdir(&self) -> &Path

Returns blob directory path.

source

pub fn emit_event(&self, event: EventType)

Emits a single event.

source

pub fn emit_msgs_changed_without_ids(&self)

Emits a generic MsgsChanged event (without chat or message id)

source

pub fn emit_msgs_changed(&self, chat_id: ChatId, msg_id: MsgId)

Emits a MsgsChanged event with specified chat and message ids

source

pub fn emit_incoming_msg(&self, chat_id: ChatId, msg_id: MsgId)

Emits an IncomingMsg event with specified chat and message ids

source

pub async fn emit_location_changed( &self, contact_id: Option<ContactId>, ) -> Result<()>

Emits an LocationChanged event and a WebxdcStatusUpdate in case there is a maps integration

source

pub fn get_event_emitter(&self) -> EventEmitter

Returns a receiver for emitted events.

Multiple emitters can be created, but note that in this case each emitted event will only be received by one of the emitters, not by all of them.

source

pub fn get_id(&self) -> u32

Get the ID of this context.

source

pub(crate) async fn alloc_ongoing(&self) -> Result<Receiver<()>>

Tries to acquire the global UI “ongoing” mutex.

This is for modal operations during which no other user actions are allowed. Only one such operation is allowed at any given time.

The return value is a cancel token, which will release the ongoing mutex when dropped.

source

pub(crate) async fn free_ongoing(&self)

source

pub async fn stop_ongoing(&self)

Signal an ongoing process to stop.

source

pub(crate) async fn shall_stop_ongoing(&self) -> bool

source

pub async fn get_info(&self) -> Result<BTreeMap<&'static str, String>>

Returns information about the context as key-value pairs.

source

async fn get_self_report(&self) -> Result<String>

source

pub async fn draft_self_report(&self) -> Result<ChatId>

Drafts a message with statistics about the usage of Delta Chat. The user can inspect the message if they want, and then hit “Send”.

On the other end, a bot will receive the message and make it available to Delta Chat’s developers.

source

pub async fn get_fresh_msgs(&self) -> Result<Vec<MsgId>>

Get a list of fresh, unmuted messages in unblocked chats.

The list starts with the most recent message and is typically used to show notifications. Moreover, the number of returned messages can be used for a badge counter on the app icon.

source

pub async fn get_next_msgs(&self) -> Result<Vec<MsgId>>

Returns a list of messages with database ID higher than requested.

Blocked contacts and chats are excluded, but self-sent messages and contact requests are included in the results.

source

pub async fn wait_next_msgs(&self) -> Result<Vec<MsgId>>

Returns a list of messages with database ID higher than last marked as seen.

This function is supposed to be used by bot to request messages that are not processed yet.

Waits for notification and returns a result. Note that the result may be empty if the message is deleted shortly after notification or notification is manually triggered to interrupt waiting. Notification may be manually triggered by calling Self::stop_io.

source

pub async fn search_msgs( &self, chat_id: Option<ChatId>, query: &str, ) -> Result<Vec<MsgId>>

Searches for messages containing the query string case-insensitively.

If chat_id is provided this searches only for messages in this chat, if chat_id is None this searches messages from all chats.

NB: Wrt the search in long messages which are shown truncated with the “Show Full Message…” button, we only look at the first several kilobytes. Let’s not fix this – one can send a dictionary in the message that matches any reasonable search request, but the user won’t see the match because they should tap on “Show Full Message…” for that. Probably such messages would only clutter search results.

source

pub async fn is_inbox(&self, folder_name: &str) -> Result<bool>

Returns true if given folder name is the name of the inbox.

source

pub async fn is_sentbox(&self, folder_name: &str) -> Result<bool>

Returns true if given folder name is the name of the “sent” folder.

source

pub async fn is_mvbox(&self, folder_name: &str) -> Result<bool>

Returns true if given folder name is the name of the “DeltaChat” folder.

source

pub async fn is_trash(&self, folder_name: &str) -> Result<bool>

Returns true if given folder name is the name of the trash folder.

source

pub(crate) async fn should_delete_to_trash(&self) -> Result<bool>

source

pub(crate) async fn get_delete_msgs_target(&self) -> Result<String>

Returns target for deleted messages as per imap table. Empty string means “delete w/o moving to trash”.

source

pub(crate) fn derive_blobdir(dbfile: &Path) -> PathBuf

source

pub(crate) fn derive_walfile(dbfile: &Path) -> PathBuf

source§

impl Context

source

pub(crate) async fn download_limit(&self) -> Result<Option<u32>>

source§

impl Context

source

pub(crate) async fn quota_needs_update(&self, ratelimit_secs: u64) -> bool

Returns whether the quota value needs an update. If so, update_recent_quota() should be called.

source

pub(crate) async fn update_recent_quota( &self, session: &mut ImapSession, ) -> Result<()>

Updates quota.recent, sets quota.modified to the current time and emits an event to let the UIs update connectivity view.

Moreover, once each time quota gets larger than QUOTA_WARN_THRESHOLD_PERCENTAGE, a device message is added. As the message is added only once, the user is not spammed in case for some providers the quota is always at ~100% and new space is allocated as needed.

source§

impl Context

source

pub async fn get_connectivity(&self) -> Connectivity

Get the current connectivity, i.e. whether the device is connected to the IMAP server. One of:

  • DC_CONNECTIVITY_NOT_CONNECTED (1000-1999): Show e.g. the string “Not connected” or a red dot
  • DC_CONNECTIVITY_CONNECTING (2000-2999): Show e.g. the string “Connecting…” or a yellow dot
  • DC_CONNECTIVITY_WORKING (3000-3999): Show e.g. the string “Updating…” or a spinning wheel
  • DC_CONNECTIVITY_CONNECTED (>=4000): Show e.g. the string “Connected” or a green dot

We don’t use exact values but ranges here so that we can split up states into multiple states in the future.

Meant as a rough overview that can be shown e.g. in the title of the main screen.

If the connectivity changes, a DC_EVENT_CONNECTIVITY_CHANGED will be emitted.

source

pub async fn get_connectivity_html(&self) -> Result<String>

Get an overview of the current connectivity, and possibly more statistics. Meant to give the user more insight about the current status than the basic connectivity info returned by dc_get_connectivity(); show this e.g., if the user taps on said basic connectivity info.

If this page changes, a DC_EVENT_CONNECTIVITY_CHANGED will be emitted.

This comes as an HTML from the core so that we can easily improve it and the improvement instantly reaches all UIs.

source

pub async fn all_work_done(&self) -> bool

Returns true if all background work is done.

source§

impl Context

source

pub async fn set_stock_translation( &self, id: StockMessage, stockstring: String, ) -> Result<()>

Set the stock string for the StockMessage.

source

pub(crate) async fn stock_protection_msg( &self, protect: ProtectionStatus, contact_id: Option<ContactId>, ) -> String

Returns a stock message saying that protection status has changed.

source

pub(crate) async fn update_device_chats(&self) -> Result<()>

source§

impl Context

source

pub(crate) async fn add_sync_item(&self, data: SyncData) -> Result<()>

Adds an item to the list of items that should be synchronized to other devices.

NB: Private and pub(crate) functions shouldn’t call this unless Sync::Sync is explicitly passed to them. This way it’s always clear whether the code performs synchronisation.

source

async fn add_sync_item_with_timestamp( &self, data: SyncData, timestamp: i64, ) -> Result<()>

Adds item and timestamp to the list of items that should be synchronized to other devices. If device synchronization is disabled, the function does nothing.

source

pub(crate) async fn sync_qr_code_tokens( &self, grpid: Option<&str>, ) -> Result<()>

Adds most recent qr-code tokens for the given group or self-contact to the list of items to be synced. If device synchronization is disabled, no tokens exist or the chat is unpromoted, the function does nothing. The caller should call SchedulerState::interrupt_inbox() on its own to trigger sending.

source

pub(crate) async fn sync_qr_code_token_deletion( &self, invitenumber: String, auth: String, ) -> Result<()>

Adds deleted qr-code token to the list of items to be synced so that the token also gets deleted on the other devices. This interrupts SMTP on its own.

source

pub async fn send_sync_msg(&self) -> Result<Option<MsgId>>

Sends out a self-sent message with items to be synchronized, if any.

Mustn’t be called from multiple tasks in parallel to avoid sending the same sync items twice because sync items are removed from the db only after successful sending. We guarantee this by calling send_sync_msg() only from the SMTP loop.

source

pub(crate) async fn build_sync_json(&self) -> Result<Option<(String, String)>>

Copies all sync items to a JSON string and clears the sync-table. Returns the JSON string and a comma-separated string of the IDs used.

source

pub(crate) fn build_sync_part(&self, json: String) -> PartBuilder

source

pub(crate) fn parse_sync_items(&self, serialized: String) -> Result<SyncItems>

Takes a JSON string created by build_sync_json() and construct SyncItems from it.

source

pub(crate) async fn execute_sync_items(&self, items: &SyncItems)

Executes sync items sent by other device.

CAVE: When changing the code to handle other sync items, take care that does not result in calls to add_sync_item() as otherwise we would add in a dead-loop between two devices sending message back and forth.

If an error is returned, the caller shall not try over because some sync items could be already executed. Sync items are considered independent and executed in the given order but regardless of whether executing of the previous items succeeded.

source

async fn add_qr_token(&self, token: &QrTokenData) -> Result<()>

source

async fn delete_qr_token(&self, token: &QrTokenData) -> Result<()>

source§

impl Context

source

pub(crate) async fn update_contacts_timestamp( &self, contact_id: ContactId, scope: Param, new_timestamp: i64, ) -> Result<bool>

Updates a contact’s timestamp, if reasonable. Returns true if the caller shall update the settings belonging to the scope. (if we have a ContactId type at some point, the function should go there)

source§

impl Context

source

pub async fn set_webxdc_integration(&self, file: &str) -> Result<()>

Sets Webxdc file as integration. file is the .xdc to use as Webxdc integration.

source

pub async fn init_webxdc_integration( &self, integrate_for: Option<ChatId>, ) -> Result<Option<MsgId>>

Returns Webxdc instance used for optional integrations. UI can open the Webxdc as usual. Returns None if there is no integration; the caller can add one using set_webxdc_integration then. integrate_for is the chat to get the integration for.

source

pub(crate) async fn update_webxdc_integration_database( &self, msg: &Message, ) -> Result<()>

source

pub(crate) async fn intercept_send_webxdc_status_update( &self, instance: Message, status_update: StatusUpdateItem, ) -> Result<()>

source

pub(crate) async fn intercept_get_webxdc_status_updates( &self, instance: Message, last_known_serial: StatusUpdateSerial, ) -> Result<String>

source§

impl Context

source

pub(crate) async fn is_webxdc_file( &self, filename: &str, file: &[u8], ) -> Result<bool>

check if a file is an acceptable webxdc for sending or receiving.

source

pub(crate) async fn ensure_sendable_webxdc_file( &self, path: &Path, ) -> Result<()>

Ensure that a file is an acceptable webxdc for sending.

source

async fn get_overwritable_info_msg_id( &self, instance: &Message, from_id: ContactId, ) -> Result<Option<MsgId>>

Check if the last message of a chat is an info message belonging to the given instance and sender. If so, the id of this message is returned.

source

async fn create_status_update_record( &self, instance: &Message, status_update_item: StatusUpdateItem, timestamp: i64, can_info_msg: bool, from_id: ContactId, ) -> Result<Option<StatusUpdateSerial>>

Takes an update-json as {payload: PAYLOAD} writes it to the database and handles events, info-messages, document name and summary.

source

pub(crate) async fn write_status_update_inner( &self, instance_id: &MsgId, status_update_item: &StatusUpdateItem, timestamp: i64, ) -> Result<Option<StatusUpdateSerial>>

Inserts a status update item into msgs_status_updates table.

Returns serial ID of the status update if a new item is inserted.

source

pub async fn get_status_update( &self, msg_id: MsgId, status_update_serial: StatusUpdateSerial, ) -> Result<String>

Returns the update_item with status_update_serial from the webxdc with message id msg_id.

source

pub async fn send_webxdc_status_update( &self, instance_msg_id: MsgId, update_str: &str, descr: &str, ) -> Result<()>

Sends a status update for an webxdc instance.

If the instance is a draft, the status update is sent once the instance is actually sent. Otherwise, the update is sent as soon as possible.

source

pub async fn send_webxdc_status_update_struct( &self, instance_msg_id: MsgId, status_update: StatusUpdateItem, descr: &str, ) -> Result<()>

Sends a status update for an webxdc instance. Also see Self::send_webxdc_status_update

source

async fn smtp_status_update_get( &self, ) -> Result<Option<(MsgId, i64, StatusUpdateSerial, String)>>

Returns one record of the queued webxdc status updates.

source

async fn smtp_status_update_pop_serials( &self, msg_id: MsgId, first: i64, first_new: StatusUpdateSerial, ) -> Result<()>

source

pub(crate) async fn flush_status_updates(&self) -> Result<()>

Attempts to send queued webxdc status updates.

source

pub(crate) fn build_status_update_part(&self, json: &str) -> PartBuilder

source

pub(crate) async fn receive_status_update( &self, from_id: ContactId, instance: &Message, timestamp: i64, can_info_msg: bool, json: &str, ) -> Result<()>

Receives status updates from receive_imf to the database and sends out an event.

instance is a webxdc instance.

from_id is the sender.

timestamp is the timestamp of the update.

json is an array containing one or more update items as created by send_webxdc_status_update(), the array is parsed using serde, the single payloads are used as is.

source

pub async fn get_webxdc_status_updates( &self, instance_msg_id: MsgId, last_known_serial: StatusUpdateSerial, ) -> Result<String>

Returns status updates as an JSON-array, ready to be consumed by a webxdc.

Example: [{"serial":1, "max_serial":3, "payload":"any update data"}, {"serial":3, "max_serial":3, "payload":"another update data"}] Updates with serials larger than last_known_serial are returned. If no last serial is known, set last_known_serial to 0. If no updates are available, an empty JSON-array is returned.

source

pub(crate) async fn render_webxdc_status_update_object( &self, instance_msg_id: MsgId, first: StatusUpdateSerial, last: StatusUpdateSerial, size_max: Option<usize>, ) -> Result<(Option<String>, StatusUpdateSerial)>

Renders JSON-object for status updates as used on the wire.

Returns optional JSON and the first serial of updates not included due to a JSON size limit. If all requested updates are included, returns the first not requested serial.

Example JSON: {"updates": [{"payload":"any update data"}, {"payload":"another update data"}]}

  • (first, last): range of status update serials to send.
source§

impl Context

source

pub async fn push_state(&self) -> NotifyState

Returns push notification subscriber state.

source§

impl Context

source

async fn init_peer_channels(&self) -> Result<Iroh>

Create iroh endpoint and gossip.

source

pub async fn get_or_try_init_peer_channel(&self) -> Result<&Iroh>

Get or initialize the iroh peer channel.

Trait Implementations§

source§

impl Clone for Context

source§

fn clone(&self) -> Context

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Context

source§

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

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

impl Deref for Context

source§

type Target = InnerContext

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> DynClone for T
where T: Clone,

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> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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