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§

impl Context

source

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

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

source

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

Get a configuration key. Returns None if no value is set, and no default value found.

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 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 async fn get_config_bool_opt(&self, key: Config) -> Result<Option<bool>>

Returns boolean configuration value (if any) 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 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 background fetch pauses the scheduler and does one imap fetch, then unpauses and returns

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.

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 “Delta Chat” 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 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, chat_id: Option<ChatId> ) -> Result<()>

Adds most recent qr-code tokens for a given chat 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.

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.

source

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

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

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) async fn delete_sync_ids(&self, ids: String) -> Result<()>

Deletes IDs as returned by build_sync_json().

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 pop_smtp_status_update( &self ) -> Result<Option<(MsgId, StatusUpdateSerial, StatusUpdateSerial, String)>>

Pops one record of queued webxdc status updates. This function exists to make the sqlite statement testable.

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, range: Option<(StatusUpdateSerial, StatusUpdateSerial)> ) -> Result<Option<String>>

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

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

range is an optional range of status update serials to send. If it is None, all updates are sent. This is used when a message is resent using crate::chat::resend_msgs.

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 magic 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

§

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> 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>

§

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
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

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> Instrument for T

source§

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

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

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.

§

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

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
source§

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

§

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
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
source§

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

§

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>,

§

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
source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,