Skip to main content

Context

Struct Context 

Source
pub(crate) struct Context<'a> {
    pub(crate) services: &'a Services,
    pub(crate) body: &'a [&'a str],
    pub(crate) timer: SystemTime,
    pub(crate) reply_id: Option<&'a EventId>,
    pub(crate) output: Mutex<BufWriter<Vec<u8>>>,
}

Fields§

§services: &'a Services§body: &'a [&'a str]§timer: SystemTime§reply_id: Option<&'a EventId>§output: Mutex<BufWriter<Vec<u8>>>

Implementations§

Source§

impl Context<'_>

Source

pub(crate) fn write_fmt( &self, arguments: Arguments<'_>, ) -> impl Future<Output = Result> + Send + '_ + use<'_>

Source

pub(crate) async fn write_string(&self, s: String) -> Result

Source

pub(crate) fn write_str<'a>( &'a self, s: &'a str, ) -> impl Future<Output = Result> + Send + 'a

Source§

impl Context<'_>

Source

pub(super) async fn appservice_register(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn appservice_unregister( &self, appservice_identifier: String, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn appservice_show_config( &self, appservice_identifier: String, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn appservice_list(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn echo(&self, message: Vec<String>) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn get_auth_chain(&self, event_id: OwnedEventId) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn parse_pdu(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn get_pdu(&self, event_id: OwnedEventId) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn get_short_pdu( &self, shortroomid: ShortRoomId, count: i64, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn get_remote_pdu_list( &self, server: OwnedServerName, force: bool, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn get_remote_pdu( &self, event_id: OwnedEventId, server: OwnedServerName, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn get_room_state( &self, room: OwnedRoomOrAliasId, kind: Option<String>, state_key: Option<String>, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn ping(&self, server: OwnedServerName) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn force_device_list_updates(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn change_log_level( &self, filter: Option<String>, reset: bool, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn sign_json(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn verify_json(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn verify_pdu(&self, event_id: OwnedEventId) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn first_pdu_in_room(&self, room_id: OwnedRoomId) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn latest_pdu_in_room(&self, room_id: OwnedRoomId) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn force_set_room_state_from_server( &self, room_id: OwnedRoomId, server_name: OwnedServerName, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn get_signing_keys( &self, server_name: Option<OwnedServerName>, notary: Option<OwnedServerName>, query: bool, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn get_verify_keys( &self, server_name: Option<OwnedServerName>, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn resolve_true_destination( &self, server_name: OwnedServerName, no_cache: bool, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn memory_stats(&self, opts: Option<String>) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn runtime_metrics(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn runtime_interval(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn task_metrics(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn task_interval(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn time(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn list_dependencies(&self, names: bool) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn database_stats( &self, property: Option<String>, map: Option<String>, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn database_files( &self, map: Option<String>, level: Option<i32>, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn trim_memory(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn create_jwt( &self, user: String, exp_from_now: Option<u64>, nbf_from_now: Option<u64>, issuer: Option<String>, audience: Option<String>, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn resync_database(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn get_retained_pdu(&self, event_id: OwnedEventId) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn dump_pdus(&self, dir: String) -> Result

Source§

impl Context<'_>

Source

async fn panic(&self) -> Result

Source§

impl Context<'_>

Source

async fn failure(&self) -> Result

Source§

impl Context<'_>

Source

async fn tester(&self) -> Result

Source§

impl Context<'_>

Source

async fn timer(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn disable_room(&self, room_id: OwnedRoomId) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn enable_room(&self, room_id: OwnedRoomId) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn incoming_federation(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn fetch_support_well_known( &self, server_name: OwnedServerName, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn remote_user_in_rooms(&self, user_id: OwnedUserId) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn delete(&self, mxc: OwnedMxcUri) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn delete_by_event(&self, event_id: OwnedEventId) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn delete_list(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn delete_range( &self, duration: String, older_than: bool, newer_than: bool, yes_i_want_to_delete_local_media: bool, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn delete_all_from_user(&self, username: String) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn delete_all_from_server( &self, server_name: OwnedServerName, yes_i_want_to_delete_local_media: bool, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn get_file_info(&self, mxc: OwnedMxcUri) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn get_remote_file( &self, mxc: OwnedMxcUri, server: Option<OwnedServerName>, timeout: u32, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn get_remote_thumbnail( &self, mxc: OwnedMxcUri, server: Option<OwnedServerName>, timeout: u32, width: u32, height: u32, ) -> Result

Source§

impl Context<'_>

Source

async fn changes_since( &self, user_id: OwnedUserId, since: u64, room_id: Option<OwnedRoomId>, ) -> Result

Source§

impl Context<'_>

Source

async fn account_data_get( &self, user_id: OwnedUserId, kind: String, room_id: Option<OwnedRoomId>, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn oauth_associate( &self, provider: String, user_id: OwnedUserId, claim: Vec<String>, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn oauth_list_providers(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn oauth_list_users(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn oauth_list_sessions( &self, user_id: Option<OwnedUserId>, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn oauth_show_provider( &self, id: ProviderId, config: bool, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn oauth_show_session(&self, id: SessionId) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn oauth_show_user(&self, user_id: OwnedUserId) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn oauth_token_info(&self, id: SessionId) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn oauth_revoke( &self, id: Either<SessionId, OwnedUserId>, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn oauth_delete( &self, id: Either<SessionId, OwnedUserId>, force: bool, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn get_pushers(&self, user_id: OwnedUserId) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn remove_pusher( &self, user_id: OwnedUserId, pushkey: String, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn raw_compact( &self, maps: Option<Vec<String>>, start: Option<String>, stop: Option<String>, from: Option<usize>, into: Option<usize>, parallelism: Option<usize>, exhaustive: bool, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn raw_count( &self, map: Option<String>, prefix: Option<String>, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn raw_keys( &self, map: String, prefix: Option<String>, limit: Option<usize>, from: Option<String>, backwards: bool, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn raw_keys_sizes( &self, map: Option<String>, prefix: Option<String>, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn raw_keys_total( &self, map: Option<String>, prefix: Option<String>, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn raw_vals_sizes( &self, map: Option<String>, prefix: Option<String>, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn raw_vals_total( &self, map: Option<String>, prefix: Option<String>, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn raw_iter( &self, map: String, prefix: Option<String>, limit: Option<usize>, from: Option<String>, backwards: bool, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn raw_del(&self, map: String, key: String) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn raw_clear(&self, map: String, confirm: bool) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn raw_get( &self, map: String, key: String, base64: bool, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn raw_sequence(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn raw_maps(&self) -> Result

Source§

impl Context<'_>

Source

async fn destinations_cache( &self, server_name: Option<OwnedServerName>, ) -> Result

Source§

impl Context<'_>

Source

async fn overrides_cache(&self, server_name: Option<String>) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn last(&self, room_id: OwnedRoomOrAliasId) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn pdus( &self, room_id: OwnedRoomOrAliasId, from: Option<String>, limit: Option<usize>, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn short_event_id(&self, event_id: OwnedEventId) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn short_room_id(&self, room_id: OwnedRoomOrAliasId) -> Result

Source§

impl Context<'_>

Source§

impl Context<'_>

Source§

impl Context<'_>

Source

async fn query_storage_debug(&self, provider: String) -> Result

Source§

impl Context<'_>

Source

async fn query_storage_show( &self, provider: Option<String>, src: String, ) -> Result

Source§

impl Context<'_>

Source

async fn query_storage_list( &self, provider: Option<String>, prefix: Option<String>, ) -> Result

Source§

impl Context<'_>

Source

async fn query_storage_duplicates( &self, provider_a: String, provider_b: String, ) -> Result

Source§

impl Context<'_>

Source

async fn query_storage_differences( &self, provider_a: String, provider_b: String, ) -> Result

Source§

impl Context<'_>

Source

async fn query_storage_copy( &self, provider: Option<String>, force: bool, src: String, dst: String, ) -> Result

Source§

impl Context<'_>

Source

async fn query_storage_move( &self, provider: Option<String>, force: bool, src: String, dst: String, ) -> Result

Source§

impl Context<'_>

Source

async fn query_storage_delete( &self, provider: Option<String>, src: Vec<String>, verbose: bool, ) -> Result

Source§

impl Context<'_>

Source

async fn query_storage_sync(&self, src: String, dst: String) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn list_connections(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn show_connection( &self, user_id: OwnedUserId, device_id: Option<OwnedDeviceId>, conn_id: Option<String>, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn drop_connections( &self, user_id: Option<OwnedUserId>, device_id: Option<OwnedDeviceId>, conn_id: Option<String>, ) -> Result

Source§

impl Context<'_>

Source

async fn auth_ldap(&self, user_dn: String, password: String) -> Result

Source§

impl Context<'_>

Source

async fn search_ldap(&self, user_id: OwnedUserId) -> Result

Source§

impl Context<'_>

Source

async fn get_shared_rooms( &self, user_a: OwnedUserId, user_b: OwnedUserId, ) -> Result

Source§

impl Context<'_>

Source

async fn get_backup_session( &self, user_id: OwnedUserId, version: String, room_id: OwnedRoomId, session_id: String, ) -> Result

Source§

impl Context<'_>

Source

async fn get_room_backups( &self, user_id: OwnedUserId, version: String, room_id: OwnedRoomId, ) -> Result

Source§

impl Context<'_>

Source

async fn get_all_backups(&self, user_id: OwnedUserId, version: String) -> Result

Source§

impl Context<'_>

Source

async fn get_backup_algorithm( &self, user_id: OwnedUserId, version: String, ) -> Result

Source§

impl Context<'_>

Source

async fn get_latest_backup_version(&self, user_id: OwnedUserId) -> Result

Source§

impl Context<'_>

Source

async fn get_latest_backup(&self, user_id: OwnedUserId) -> Result

Source§

impl Context<'_>

Source

async fn iter_users(&self) -> Result

Source§

impl Context<'_>

Source

async fn count_users(&self) -> Result

Source§

impl Context<'_>

Source

async fn password_hash(&self, user_id: OwnedUserId) -> Result

Source§

impl Context<'_>

Source

async fn list_devices(&self, user_id: OwnedUserId) -> Result

Source§

impl Context<'_>

Source

async fn list_devices_metadata(&self, user_id: OwnedUserId) -> Result

Source§

impl Context<'_>

Source

async fn get_device_metadata( &self, user_id: OwnedUserId, device_id: OwnedDeviceId, ) -> Result

Source§

impl Context<'_>

Source

async fn get_devices_version(&self, user_id: OwnedUserId) -> Result

Source§

impl Context<'_>

Source

async fn count_one_time_keys( &self, user_id: OwnedUserId, device_id: OwnedDeviceId, ) -> Result

Source§

impl Context<'_>

Source

async fn get_device_keys( &self, user_id: OwnedUserId, device_id: OwnedDeviceId, ) -> Result

Source§

impl Context<'_>

Source

async fn get_user_signing_key(&self, user_id: OwnedUserId) -> Result

Source§

impl Context<'_>

Source

async fn get_master_key(&self, user_id: OwnedUserId) -> Result

Source§

impl Context<'_>

Source

async fn get_to_device_events( &self, user_id: OwnedUserId, device_id: OwnedDeviceId, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn alias_set( &self, force: bool, room_id: OwnedRoomId, room_alias_localpart: String, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn alias_remove(&self, room_alias_localpart: String) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn alias_which(&self, room_alias_localpart: String) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn alias_list(&self, room_id: Option<OwnedRoomId>) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn room_list( &self, page: Option<usize>, exclude_disabled: bool, exclude_banned: bool, no_details: bool, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn room_exists(&self, room_id: OwnedRoomId) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn room_delete( &self, room_id: OwnedRoomId, force: bool, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn room_prune_empty(&self, force: bool) -> Result

Source§

impl Context<'_>

Source

async fn list_joined_members( &self, room_id: OwnedRoomId, local_only: bool, ) -> Result

Source§

impl Context<'_>

Source

async fn view_room_topic(&self, room_id: OwnedRoomId) -> Result

Source§

impl Context<'_>

Source

async fn ban_room(&self, room: OwnedRoomOrAliasId) -> Result

Source§

impl Context<'_>

Source

async fn ban_list_of_rooms(&self) -> Result

Source§

impl Context<'_>

Source

async fn unban_room(&self, room: OwnedRoomOrAliasId) -> Result

Source§

impl Context<'_>

Source

async fn list_banned_rooms(&self, no_details: bool) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn uptime(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn show_config(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn reload_config(&self, path: Option<PathBuf>) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn list_features( &self, available: bool, enabled: bool, comma: bool, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn memory_usage(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn clear_caches(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn list_backups(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn backup_database(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn admin_notice(&self, message: Vec<String>) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn reload_mods(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn restart(&self, force: bool) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn shutdown(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn issue( &self, max_uses: Option<u64>, max_age: Option<String>, once: bool, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn revoke(&self, token: String) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn list(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn list_users(&self) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn create_user( &self, username: String, password: Option<String>, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn deactivate( &self, no_leave_rooms: bool, user_id: String, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn delete_device( &self, user_id: OwnedUserId, device_id: OwnedDeviceId, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn reset_password( &self, username: String, password: Option<String>, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn deactivate_all( &self, no_leave_rooms: bool, force: bool, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn list_joined_rooms(&self, user_id: String) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn force_join_list_of_local_users( &self, room: OwnedRoomOrAliasId, yes_i_want_to_do_this: bool, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn force_join_all_local_users( &self, room: OwnedRoomOrAliasId, yes_i_want_to_do_this: bool, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn force_join_room( &self, user_id: String, room: OwnedRoomOrAliasId, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn force_leave_room( &self, user_id: String, room_id: OwnedRoomOrAliasId, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn reject_invites( &self, user_id: String, reason: Option<String>, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn force_demote( &self, user_id: String, room_id: OwnedRoomOrAliasId, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn force_promote( &self, target_id: String, room_id: OwnedRoomOrAliasId, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn make_user_admin(&self, user_id: String) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn put_room_tag( &self, user_id: String, room_id: OwnedRoomId, tag: String, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn delete_room_tag( &self, user_id: String, room_id: OwnedRoomId, tag: String, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn get_room_tags( &self, user_id: String, room_id: OwnedRoomId, ) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn redact_event(&self, event_id: OwnedEventId) -> Result

Source§

impl Context<'_>

Source

pub(super) async fn last_active(&self, limit: Option<usize>) -> Result

Auto Trait Implementations§

§

impl<'a> !Freeze for Context<'a>

§

impl<'a> !RefUnwindSafe for Context<'a>

§

impl<'a> Send for Context<'a>

§

impl<'a> Sync for Context<'a>

§

impl<'a> Unpin for Context<'a>

§

impl<'a> UnsafeUnpin for Context<'a>

§

impl<'a> !UnwindSafe for Context<'a>

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

§

type Flavor = MayDrop

The DropFlavor that [wrap]s T into Self
Source§

impl<T> ExpectInto for T

Source§

fn expect_into<Dst>(self) -> Dst
where Dst: TryFrom<Self>, Self: Sized,

Source§

impl<T> Expected for T

Source§

fn expected_add(self, rhs: Self) -> Self
where Self: Sized + CheckedAdd,

Source§

fn expected_sub(self, rhs: Self) -> Self
where Self: Sized + CheckedSub,

Source§

fn expected_mul(self, rhs: Self) -> Self
where Self: Sized + CheckedMul,

Source§

fn expected_div(self, rhs: Self) -> Self
where Self: Sized + CheckedDiv,

Source§

fn expected_rem(self, rhs: Self) -> Self
where Self: Sized + CheckedRem,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

§

const WITNESS: W = W::MAKE

A constant of the type witness
§

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

§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
§

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

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

§

fn fg(&self, value: Color) -> Painted<&T>

Returns a styled value derived from self with the foreground set to value.

This method should be used rarely. Instead, prefer to use color-specific builder methods like red() and green(), which have the same functionality but are pithier.

§Example

Set foreground color to white using fg():

use yansi::{Paint, Color};

painted.fg(Color::White);

Set foreground color to white using white().

use yansi::Paint;

painted.white();
§

fn primary(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Primary].

§Example
println!("{}", value.primary());
§

fn fixed(&self, color: u8) -> Painted<&T>

Returns self with the fg() set to [Color :: Fixed].

§Example
println!("{}", value.fixed(color));
§

fn rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the fg() set to [Color :: Rgb].

§Example
println!("{}", value.rgb(r, g, b));
§

fn black(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Black].

§Example
println!("{}", value.black());
§

fn red(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Red].

§Example
println!("{}", value.red());
§

fn green(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Green].

§Example
println!("{}", value.green());
§

fn yellow(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Yellow].

§Example
println!("{}", value.yellow());
§

fn blue(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Blue].

§Example
println!("{}", value.blue());
§

fn magenta(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Magenta].

§Example
println!("{}", value.magenta());
§

fn cyan(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Cyan].

§Example
println!("{}", value.cyan());
§

fn white(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: White].

§Example
println!("{}", value.white());
§

fn bright_black(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightBlack].

§Example
println!("{}", value.bright_black());
§

fn bright_red(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightRed].

§Example
println!("{}", value.bright_red());
§

fn bright_green(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightGreen].

§Example
println!("{}", value.bright_green());
§

fn bright_yellow(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightYellow].

§Example
println!("{}", value.bright_yellow());
§

fn bright_blue(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightBlue].

§Example
println!("{}", value.bright_blue());
§

fn bright_magenta(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightMagenta].

§Example
println!("{}", value.bright_magenta());
§

fn bright_cyan(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightCyan].

§Example
println!("{}", value.bright_cyan());
§

fn bright_white(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightWhite].

§Example
println!("{}", value.bright_white());
§

fn bg(&self, value: Color) -> Painted<&T>

Returns a styled value derived from self with the background set to value.

This method should be used rarely. Instead, prefer to use color-specific builder methods like on_red() and on_green(), which have the same functionality but are pithier.

§Example

Set background color to red using fg():

use yansi::{Paint, Color};

painted.bg(Color::Red);

Set background color to red using on_red().

use yansi::Paint;

painted.on_red();
§

fn on_primary(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Primary].

§Example
println!("{}", value.on_primary());
§

fn on_fixed(&self, color: u8) -> Painted<&T>

Returns self with the bg() set to [Color :: Fixed].

§Example
println!("{}", value.on_fixed(color));
§

fn on_rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the bg() set to [Color :: Rgb].

§Example
println!("{}", value.on_rgb(r, g, b));
§

fn on_black(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Black].

§Example
println!("{}", value.on_black());
§

fn on_red(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Red].

§Example
println!("{}", value.on_red());
§

fn on_green(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Green].

§Example
println!("{}", value.on_green());
§

fn on_yellow(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Yellow].

§Example
println!("{}", value.on_yellow());
§

fn on_blue(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Blue].

§Example
println!("{}", value.on_blue());
§

fn on_magenta(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Magenta].

§Example
println!("{}", value.on_magenta());
§

fn on_cyan(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Cyan].

§Example
println!("{}", value.on_cyan());
§

fn on_white(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: White].

§Example
println!("{}", value.on_white());
§

fn on_bright_black(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightBlack].

§Example
println!("{}", value.on_bright_black());
§

fn on_bright_red(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightRed].

§Example
println!("{}", value.on_bright_red());
§

fn on_bright_green(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightGreen].

§Example
println!("{}", value.on_bright_green());
§

fn on_bright_yellow(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightYellow].

§Example
println!("{}", value.on_bright_yellow());
§

fn on_bright_blue(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightBlue].

§Example
println!("{}", value.on_bright_blue());
§

fn on_bright_magenta(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightMagenta].

§Example
println!("{}", value.on_bright_magenta());
§

fn on_bright_cyan(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightCyan].

§Example
println!("{}", value.on_bright_cyan());
§

fn on_bright_white(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightWhite].

§Example
println!("{}", value.on_bright_white());
§

fn attr(&self, value: Attribute) -> Painted<&T>

Enables the styling [Attribute] value.

This method should be used rarely. Instead, prefer to use attribute-specific builder methods like bold() and underline(), which have the same functionality but are pithier.

§Example

Make text bold using attr():

use yansi::{Paint, Attribute};

painted.attr(Attribute::Bold);

Make text bold using using bold().

use yansi::Paint;

painted.bold();
§

fn bold(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Bold].

§Example
println!("{}", value.bold());
§

fn dim(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Dim].

§Example
println!("{}", value.dim());
§

fn italic(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Italic].

§Example
println!("{}", value.italic());
§

fn underline(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Underline].

§Example
println!("{}", value.underline());

Returns self with the attr() set to [Attribute :: Blink].

§Example
println!("{}", value.blink());

Returns self with the attr() set to [Attribute :: RapidBlink].

§Example
println!("{}", value.rapid_blink());
§

fn invert(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Invert].

§Example
println!("{}", value.invert());
§

fn conceal(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Conceal].

§Example
println!("{}", value.conceal());
§

fn strike(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Strike].

§Example
println!("{}", value.strike());
§

fn quirk(&self, value: Quirk) -> Painted<&T>

Enables the yansi [Quirk] value.

This method should be used rarely. Instead, prefer to use quirk-specific builder methods like mask() and wrap(), which have the same functionality but are pithier.

§Example

Enable wrapping using .quirk():

use yansi::{Paint, Quirk};

painted.quirk(Quirk::Wrap);

Enable wrapping using wrap().

use yansi::Paint;

painted.wrap();
§

fn mask(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Mask].

§Example
println!("{}", value.mask());
§

fn wrap(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Wrap].

§Example
println!("{}", value.wrap());
§

fn linger(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Linger].

§Example
println!("{}", value.linger());
§

fn clear(&self) -> Painted<&T>

👎Deprecated since 1.0.1:

renamed to resetting() due to conflicts with Vec::clear(). The clear() method will be removed in a future release.

Returns self with the quirk() set to [Quirk :: Clear].

§Example
println!("{}", value.clear());
§

fn resetting(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Resetting].

§Example
println!("{}", value.resetting());
§

fn bright(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Bright].

§Example
println!("{}", value.bright());
§

fn on_bright(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: OnBright].

§Example
println!("{}", value.on_bright());
§

fn whenever(&self, value: Condition) -> Painted<&T>

Conditionally enable styling based on whether the [Condition] value applies. Replaces any previous condition.

See the crate level docs for more details.

§Example

Enable styling painted only when both stdout and stderr are TTYs:

use yansi::{Paint, Condition};

painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);
§

fn new(self) -> Painted<Self>
where Self: Sized,

Create a new [Painted] with a default [Style]. Read more
§

fn paint<S>(&self, style: S) -> Painted<&Self>
where S: Into<Style>,

Apply a style wholesale to self. Any previous style is replaced. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> ServiceExt for T

§

fn add_extension<T>(self, value: T) -> AddExtension<Self, T>
where Self: Sized,

Add some shareable value to request extensions. Read more
§

fn compression(self) -> Compression<Self>
where Self: Sized,

Compresses response bodies. Read more
§

fn decompression(self) -> Decompression<Self>
where Self: Sized,

Decompress response bodies. Read more
§

fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using HTTP status codes. Read more
§

fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using gRPC headers. Read more
§

fn follow_redirects(self) -> FollowRedirect<Self>
where Self: Sized,

Follow redirect resposes using the Standard policy. Read more
§

fn sensitive_headers( self, headers: impl IntoIterator<Item = HeaderName>, ) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>
where Self: Sized,

Mark headers as sensitive on both requests and responses. Read more
§

fn sensitive_request_headers( self, headers: impl IntoIterator<Item = HeaderName>, ) -> SetSensitiveRequestHeaders<Self>
where Self: Sized,

Mark headers as sensitive on requests. Read more
§

fn sensitive_response_headers( self, headers: impl IntoIterator<Item = HeaderName>, ) -> SetSensitiveResponseHeaders<Self>
where Self: Sized,

Mark headers as sensitive on responses. Read more
§

fn override_request_header<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Insert a header into the request. Read more
§

fn append_request_header<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Append a header into the request. Read more
§

fn insert_request_header_if_not_present<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Insert a header into the request, if the header is not already present. Read more
§

fn override_response_header<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Insert a header into the response. Read more
§

fn append_response_header<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Append a header into the response. Read more
§

fn insert_response_header_if_not_present<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Insert a header into the response, if the header is not already present. Read more
§

fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>
where Self: Sized,

Catch panics and convert them into 500 Internal Server responses. Read more
Source§

impl<T> Tried for T

Source§

fn try_add(self, rhs: Self) -> Result<Self, Error>
where Self: Sized + CheckedAdd,

Source§

fn try_sub(self, rhs: Self) -> Result<Self, Error>
where Self: Sized + CheckedSub,

Source§

fn try_mul(self, rhs: Self) -> Result<Self, Error>
where Self: Sized + CheckedMul,

Source§

fn try_div(self, rhs: Self) -> Result<Self, Error>
where Self: Sized + CheckedDiv,

Source§

fn try_rem(self, rhs: Self) -> Result<Self, Error>
where Self: Sized + CheckedRem,

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<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> JsonCastable<CanonicalJsonValue> for T

§

impl<T> JsonCastable<Value> for T