pub struct Service {
services: Arc<OnceServices>,
db: Data,
device_list_mutex: MutexMap<OwnedUserId, ()>,
}Fields§
§services: Arc<OnceServices>§db: Data§device_list_mutex: MutexMap<OwnedUserId, ()>Implementations§
Source§impl Service
impl Service
Sourcepub async fn set_dehydrated_device(
&self,
user_id: &UserId,
request: Request,
) -> Result
pub async fn set_dehydrated_device( &self, user_id: &UserId, request: Request, ) -> Result
Creates or recreates the user’s dehydrated device.
Source§impl Service
impl Service
Sourcepub(super) async fn remove_dehydrated_device(
&self,
user_id: &UserId,
maybe_device_id: Option<&DeviceId>,
) -> Result<OwnedDeviceId>
pub(super) async fn remove_dehydrated_device( &self, user_id: &UserId, maybe_device_id: Option<&DeviceId>, ) -> Result<OwnedDeviceId>
Removes a user’s dehydrated device.
Calling this directly will remove the dehydrated data but leak the frontage device. Thus this is called by the regular device interface such that the dehydrated data will not leak instead.
If device_id is given, the user’s dehydrated device must match or this is a no-op, but an Err is still returned to indicate that. Otherwise returns the removed dehydrated device_id.
Source§impl Service
impl Service
Sourcepub async fn get_dehydrated_device_id(
&self,
user_id: &UserId,
) -> Result<OwnedDeviceId>
pub async fn get_dehydrated_device_id( &self, user_id: &UserId, ) -> Result<OwnedDeviceId>
Get the device_id of the user’s dehydrated device.
Source§impl Service
impl Service
Sourcepub async fn get_dehydrated_device(
&self,
user_id: &UserId,
) -> Result<DehydratedDevice>
pub async fn get_dehydrated_device( &self, user_id: &UserId, ) -> Result<DehydratedDevice>
Get the dehydrated device private data
Source§impl Service
impl Service
Sourcepub async fn create_device(
&self,
user_id: &UserId,
device_id: Option<&DeviceId>,
__arg3: (Option<&str>, Option<Duration>),
refresh_token: Option<&str>,
initial_device_display_name: Option<&str>,
client_ip: Option<IpAddr>,
) -> Result<OwnedDeviceId>
pub async fn create_device( &self, user_id: &UserId, device_id: Option<&DeviceId>, __arg3: (Option<&str>, Option<Duration>), refresh_token: Option<&str>, initial_device_display_name: Option<&str>, client_ip: Option<IpAddr>, ) -> Result<OwnedDeviceId>
Adds a new device to a user.
A device ID coinciding with one of the user’s cross-signing key IDs is refused, since both share the device key row space.
Source§impl Service
impl Service
Sourcepub async fn remove_device(&self, user_id: &UserId, device_id: &DeviceId)
pub async fn remove_device(&self, user_id: &UserId, device_id: &DeviceId)
Removes a device from a user.
Everything keyed by the device goes with it, its identity keys included, so a later session under the same ID starts with none.
Source§impl Service
impl Service
Sourcepub fn all_device_ids<'a>(
&'a self,
user_id: &'a UserId,
) -> impl Stream<Item = &DeviceId> + Send + 'a
pub fn all_device_ids<'a>( &'a self, user_id: &'a UserId, ) -> impl Stream<Item = &DeviceId> + Send + 'a
Returns an iterator over all device ids of this user.
Source§impl Service
impl Service
Sourcepub async fn find_from_token(
&self,
token: &str,
) -> Result<(OwnedUserId, OwnedDeviceId, Option<SystemTime>)>
pub async fn find_from_token( &self, token: &str, ) -> Result<(OwnedUserId, OwnedDeviceId, Option<SystemTime>)>
Find out which user an access or refresh token belongs to.
Source§impl Service
impl Service
pub async fn remove_tokens(&self, user_id: &UserId, device_id: &DeviceId)
Source§impl Service
impl Service
Sourcepub async fn remove_access_token(
&self,
user_id: &UserId,
device_id: &DeviceId,
) -> Result
pub async fn remove_access_token( &self, user_id: &UserId, device_id: &DeviceId, ) -> Result
Revoke every access token of one device, without deleting the device. Take care to not leave dangling devices if using this method.
Source§impl Service
impl Service
Sourcepub async fn remove_access_token_value(&self, access_token: &str)
pub async fn remove_access_token_value(&self, access_token: &str)
Revoke a single access token by value, leaving the device and any other tokens it holds intact.
Source§impl Service
impl Service
Sourcepub async fn set_refresh_token(
&self,
user_id: &UserId,
device_id: &DeviceId,
refresh_token: &str,
) -> Result
pub async fn set_refresh_token( &self, user_id: &UserId, device_id: &DeviceId, refresh_token: &str, ) -> Result
Replaces the refresh token of one device.
Source§impl Service
impl Service
Sourceasync fn find_refresh_token_expires_at(
&self,
user_id: &UserId,
device_id: &DeviceId,
) -> Option<SystemTime>
async fn find_refresh_token_expires_at( &self, user_id: &UserId, device_id: &DeviceId, ) -> Option<SystemTime>
Look up the expiry stored alongside the current refresh token for this
device, if one is recorded. Pre-rotation entries carry no expiry and
return None.
Source§impl Service
impl Service
Sourcepub async fn remove_refresh_token(
&self,
user_id: &UserId,
device_id: &DeviceId,
) -> Result
pub async fn remove_refresh_token( &self, user_id: &UserId, device_id: &DeviceId, ) -> Result
Revoke the refresh token without deleting the device. Take care to not leave dangling devices if using this method.
Source§impl Service
impl Service
Sourceasync fn forget_spent_refresh_token(
&self,
user_id: &UserId,
device_id: &DeviceId,
txn: &mut Txn,
)
async fn forget_spent_refresh_token( &self, user_id: &UserId, device_id: &DeviceId, txn: &mut Txn, )
Drop the spent (previous-generation) refresh token retained for reuse detection, if any.
Source§impl Service
impl Service
Sourcepub async fn classify_refresh_token(&self, presented: &str) -> RefreshToken
pub async fn classify_refresh_token(&self, presented: &str) -> RefreshToken
Classify a presented refresh token for the token-endpoint rotation path.
Source§impl Service
impl Service
pub fn add_to_device_event( &self, sender: &UserId, target_user_id: &UserId, target_device_id: &DeviceId, event_type: &str, content: &Value, ) -> u64
Source§impl Service
impl Service
Sourcepub async fn put_device_metadata(
&self,
user_id: &UserId,
notify: bool,
device: &Device,
)
pub async fn put_device_metadata( &self, user_id: &UserId, notify: bool, device: &Device, )
Persists device metadata and optionally announces the changed device.
Silent updates leave the device-list version and notification rows unchanged.
Source§impl Service
impl Service
Sourcepub async fn get_device_metadata(
&self,
user_id: &UserId,
device_id: &DeviceId,
) -> Result<Device>
pub async fn get_device_metadata( &self, user_id: &UserId, device_id: &DeviceId, ) -> Result<Device>
Get device metadata.
Source§impl Service
impl Service
pub async fn device_exists( &self, user_id: &UserId, device_id: &DeviceId, ) -> bool
Source§impl Service
impl Service
pub async fn is_oidc_device( &self, user_id: &UserId, device_id: &DeviceId, ) -> bool
Source§impl Service
impl Service
Sourcepub async fn get_oidc_device_idp(
&self,
user_id: &UserId,
device_id: &DeviceId,
) -> Option<String>
pub async fn get_oidc_device_idp( &self, user_id: &UserId, device_id: &DeviceId, ) -> Option<String>
Returns the IdP that originally authenticated this device, if known.
Returns None for devices predating the idp_id field or non-OIDC devices.
Source§impl Service
impl Service
pub fn mark_oidc_device( &self, user_id: &UserId, device_id: &DeviceId, idp_id: &str, )
Source§impl Service
impl Service
Sourcepub fn allow_cross_signing_replacement(&self, user_id: &UserId) -> SystemTime
pub fn allow_cross_signing_replacement(&self, user_id: &UserId) -> SystemTime
Allow cross-signing key replacement without UIAA for the next 10 minutes. Returns the expiry timestamp in milliseconds.
Source§impl Service
impl Service
Sourcepub async fn can_replace_cross_signing_keys(&self, user_id: &UserId) -> bool
pub async fn can_replace_cross_signing_keys(&self, user_id: &UserId) -> bool
Check if the user is allowed to replace cross-signing keys without UIAA.
Source§impl Service
impl Service
pub async fn get_devicelist_version(&self, user_id: &UserId) -> Result<u64>
Source§impl Service
impl Service
pub fn all_devices_metadata<'a>( &'a self, user_id: &'a UserId, ) -> impl Stream<Item = Device> + Send + 'a
Source§impl Service
impl Service
Sourcepub async fn invite_filter(&self, recipient: &UserId) -> InviteFilter
pub async fn invite_filter(&self, recipient: &UserId) -> InviteFilter
Fetch the invite filtering state a recipient has configured.
The four account data slots are read concurrently, and a slot that is absent or malformed drops out rather than failing the others.
Source§impl Service
impl Service
Sourceasync fn stable_config(
&self,
recipient: &UserId,
) -> Option<InvitePermissionConfigEventContent>
async fn stable_config( &self, recipient: &UserId, ) -> Option<InvitePermissionConfigEventContent>
The stable slot, keeping its blanket switch even when its lists are not.
MSC4155 invalidates the whole event when a rule list is not an array, but the blanket block is stable spec and outranks the lists, so it is read back on its own rather than lost with them.
Source§impl Service
impl Service
Sourcepub async fn invite_permission(
&self,
sender: &UserId,
recipient: &UserId,
) -> InvitePermission
pub async fn invite_permission( &self, sender: &UserId, recipient: &UserId, ) -> InvitePermission
The recipient’s verdict on a single invite from one sender.
Fetches the filtering state and discards it, so a caller judging several
senders should hold an InviteFilter instead.
Source§impl Service
impl Service
pub async fn add_one_time_keys( &self, user_id: &UserId, device_id: &DeviceId, keys: &BTreeMap<OwnedOneTimeKeyId, Raw<OneTimeKey>>, limit: usize, ) -> Result
Source§impl Service
impl Service
pub async fn add_fallback_keys<'a, Keys>( &self, user_id: &UserId, device_id: &DeviceId, keys: Keys, ) -> Result
Source§impl Service
impl Service
pub async fn take_fallback_key( &self, user_id: &UserId, device_id: &DeviceId, algorithm: &OneTimeKeyAlgorithm, ) -> Result<(OwnedKeyId<OneTimeKeyAlgorithm, OneTimeKeyName>, Raw<OneTimeKey>)>
Source§impl Service
impl Service
pub fn unused_fallback_key_algorithms<'a>( &'a self, user_id: &'a UserId, device_id: &'a DeviceId, ) -> impl Stream<Item = OneTimeKeyAlgorithm> + Send + 'a
Source§impl Service
impl Service
pub async fn take_one_time_key( &self, user_id: &UserId, device_id: &DeviceId, key_algorithm: &OneTimeKeyAlgorithm, ) -> Result<(OwnedKeyId<OneTimeKeyAlgorithm, OneTimeKeyName>, Raw<OneTimeKey>)>
Source§impl Service
impl Service
pub async fn count_one_time_keys( &self, user_id: &UserId, device_id: &DeviceId, ) -> BTreeMap<OneTimeKeyAlgorithm, UInt>
Source§impl Service
impl Service
Sourcepub async fn prune_one_time_keys(
&self,
user_id: &UserId,
device_id: &DeviceId,
excess: usize,
)
pub async fn prune_one_time_keys( &self, user_id: &UserId, device_id: &DeviceId, excess: usize, )
MSC4225: drop the excess oldest rows for this (user, device). Forward
iteration over the prefix runs in count_be ascending order, so
take(excess) yields the earliest-uploaded rows.
Source§impl Service
impl Service
Sourcepub async fn remove_one_time_keys(&self, user_id: &UserId, device_id: &DeviceId)
pub async fn remove_one_time_keys(&self, user_id: &UserId, device_id: &DeviceId)
Drops every one-time key still outstanding for this (user, device).
Device removal has to reach the pool as well as the MSC2732 fallback key, or a claim against the deleted device still succeeds from the rows left behind.
Source§impl Service
impl Service
pub async fn add_device_keys( &self, user_id: &UserId, device_id: &DeviceId, device_keys: &Raw<DeviceKeys>, )
Source§impl Service
impl Service
pub(super) async fn is_cross_signing_key_id( &self, user_id: &UserId, key_id: &str, ) -> Result<bool>
Source§impl Service
impl Service
Sourcepub async fn mark_device_key_update(
&self,
user_id: &UserId,
change: DeviceListChange<&DeviceId>,
)
pub async fn mark_device_key_update( &self, user_id: &UserId, change: DeviceListChange<&DeviceId>, )
Records a device-list change for a user and pushes it to interested peers.
The change is durable before any peer is contacted, and the unbounded sender channels refuse only once closed, so a refused flush is a shutdown race rather than a fault.
Source§impl Service
impl Service
Sourcepub async fn device_list_change(&self, count: u64) -> Result<DeviceListRecord>
pub async fn device_list_change(&self, count: u64) -> Result<DeviceListRecord>
Reads the mutation recorded for a local device-list notification.
Missing records return NotFound; unknown kind tags request a snapshot resync.
Source§impl Service
impl Service
pub async fn get_device_keys<'a>( &'a self, user_id: &'a UserId, device_id: &DeviceId, ) -> Result<Raw<DeviceKeys>>
Source§impl Service
impl Service
pub async fn get_user_signing_key( &self, user_id: &UserId, ) -> Result<Raw<CrossSigningKey>>
Source§impl Service
impl Service
async fn ldap_connect(&self, principal: &str) -> Result<(JoinHandle<()>, Ldap)>
Source§impl Service
impl Service
Sourcepub fn ldap_bind_dn(&self, localpart: &str) -> Option<String>
pub fn ldap_bind_dn(&self, localpart: &str) -> Option<String>
Builds the user bind DN by substituting the escaped localpart into the
configured bind_dn template, or None when no {username} template is
set.
Source§impl Service
impl Service
Sourcepub async fn full_register(&self, __arg1: Register<'_>) -> Result
pub async fn full_register(&self, __arg1: Register<'_>) -> Result
Fully register a local user
Returns a device id and access token for the registered user
Source§impl Service
impl Service
Sourcepub async fn validate_server_user(&self) -> Result
pub async fn validate_server_user(&self) -> Result
Rejects changes to the server identity recorded by an existing database.
The localpart is stamped on the first boot and compared exactly afterwards. A database from before the stamp is backfilled from its admin room.
Source§impl Service
impl Service
Sourceasync fn backfill_server_user(&self, configured: &str) -> Result
async fn backfill_server_user(&self, configured: &str) -> Result
Stamps the identity on a database that pre-dates SERVER_USER_KEY.
Membership of the admin room establishes the identity, or an empty user table when there is no admin room; room creation does not, since a rebuilt admin room has a human creator. The legacy identity otherwise boots unstamped and any other is refused. A read-only database is validated but never stamped.
Source§impl Service
impl Service
Sourceasync fn admin_room_joined(&self) -> Result<Option<bool>>
async fn admin_room_joined(&self) -> Result<Option<bool>>
Reports whether the server user is joined to the admin room, or nothing without an admin alias.
An unjoined server user also means admin commands cannot work.
Source§impl Service
impl Service
Sourcepub async fn user_is_ignored(
&self,
sender_user: &UserId,
recipient_user: &UserId,
) -> bool
pub async fn user_is_ignored( &self, sender_user: &UserId, recipient_user: &UserId, ) -> bool
Returns true/false based on whether the recipient/receiving user has blocked the sender
Sourcepub async fn ignored_users(
&self,
user_id: &UserId,
) -> Option<IgnoredUserListEventContent>
pub async fn ignored_users( &self, user_id: &UserId, ) -> Option<IgnoredUserListEventContent>
The users a user ignores account-wide.
Callers testing one list against many users take this rather than
Self::user_is_ignored, which re-reads the list per test.
Sourcepub async fn create(
&self,
user_id: &UserId,
password: Option<&str>,
origin: Option<&str>,
) -> Result
pub async fn create( &self, user_id: &UserId, password: Option<&str>, origin: Option<&str>, ) -> Result
Create a new user account on this homeserver.
User origin is by default “password” (meaning that it will login using its user_id/password). Users with other origins (currently only “ldap” is available) have special login processes.
Sourcepub async fn check_creation(&self, user_id: &UserId) -> Result
pub async fn check_creation(&self, user_id: &UserId) -> Result
Refuses a local user ID that once joined the admin room but has no account.
Refusals return M_USER_IN_USE and log the user ID without changing account
or membership state. Existing accounts and the server user remain eligible.
Sourcepub async fn deactivate_account(&self, user_id: &UserId) -> Result
pub async fn deactivate_account(&self, user_id: &UserId) -> Result
Deactivate account
Sourcepub async fn exists(&self, user_id: &UserId) -> bool
pub async fn exists(&self, user_id: &UserId) -> bool
Check if a user has an account on this homeserver.
Sourcepub async fn is_deactivated(&self, user_id: &UserId) -> Result<bool>
pub async fn is_deactivated(&self, user_id: &UserId) -> Result<bool>
Check if account is deactivated
Sourcepub async fn is_active_local(&self, user_id: &UserId) -> bool
pub async fn is_active_local(&self, user_id: &UserId) -> bool
Check if account is active, infallible
Sourcepub async fn check_ldap_login(&self, user_id: &UserId) -> Result
pub async fn check_ldap_login(&self, user_id: &UserId) -> Result
Gate an LDAP-authenticated login into an existing local account.
Only a deactivated account is rejected. A password-origin account passes, since a successful bind establishes the caller’s identity however their account was created, and a localpart with no local account passes on its way to registration.
Sourcepub async fn deactivated_check(&self, user_id: &UserId) -> Result
pub async fn deactivated_check(&self, user_id: &UserId) -> Result
Reject a deactivated account with 403 M_USER_DEACTIVATED.
An account that does not exist is not deactivated, as in Synapse. One created without a password, as an appservice’s users often are, reads as deactivated, since both store an empty password.
Sourcepub async fn is_suspended(&self, user_id: &UserId) -> bool
pub async fn is_suspended(&self, user_id: &UserId) -> bool
MSC3823: account is suspended (read-mostly mode, sessions retained).
Sourcepub async fn locked_check(&self, user_id: &UserId) -> Result
pub async fn locked_check(&self, user_id: &UserId) -> Result
MSC3939: reject a request from a locked account.
The rejection maps to 401 M_USER_LOCKED with soft_logout: true, so
the client retains its session and polls for the unlock. The login and
refresh routes and the request middleware share this gate.
Sourcepub async fn is_locked(&self, user_id: &UserId) -> bool
pub async fn is_locked(&self, user_id: &UserId) -> bool
MSC3939: account is locked (401 + soft_logout, sessions retained).
The row’s presence is the entire state, and locking never invalidates
access tokens, so clearing the row restores every session intact.
Both locked_check and the admin lock surfaces read it.
Sourcepub async fn is_erased(&self, user_id: &UserId) -> bool
pub async fn is_erased(&self, user_id: &UserId) -> bool
MSC4025: the user’s events serve as pruned copies to recipients not joined at the event. Presence-only for the serving gate.
Sourcepub async fn erasure_count(&self, user_id: &UserId) -> Option<PduCount>
pub async fn erasure_count(&self, user_id: &UserId) -> Option<PduCount>
MSC4025: the global count recorded at erasure, for admin surfacing; the serving gate never reads it.
Sourcepub async fn get_suspension(&self, user_id: &UserId) -> Option<Moderation>
pub async fn get_suspension(&self, user_id: &UserId) -> Option<Moderation>
MSC3823: forensic record for the active suspension, if any.
Sourcepub async fn get_lock(&self, user_id: &UserId) -> Option<Moderation>
pub async fn get_lock(&self, user_id: &UserId) -> Option<Moderation>
MSC3939: forensic record for the active lock, if any.
pub fn set_suspended(&self, user_id: &UserId, by: &UserId)
pub fn clear_suspended(&self, user_id: &UserId)
Sourcepub fn set_erased(&self, user_id: &UserId)
pub fn set_erased(&self, user_id: &UserId)
MSC4025: mark the user erased, recording the current global count.
Sourcepub fn clear_erased(&self, user_id: &UserId)
pub fn clear_erased(&self, user_id: &UserId)
MSC4025: erasure is reversible; clearing the marker restores the unredacted view.
pub fn set_locked(&self, user_id: &UserId, by: &UserId)
pub fn clear_locked(&self, user_id: &UserId)
Sourcepub async fn is_empty(&self) -> Result<bool>
pub async fn is_empty(&self) -> Result<bool>
Returns whether the user table contains no accounts.
The lookup stops after the first account and propagates storage errors.
Sourcepub fn stream(&self) -> impl Stream<Item = &UserId> + Send
pub fn stream(&self) -> impl Stream<Item = &UserId> + Send
Returns an iterator over all users on this homeserver.
Sourcepub fn list_local_users(&self) -> impl Stream<Item = &UserId> + Send + '_
pub fn list_local_users(&self) -> impl Stream<Item = &UserId> + Send + '_
Returns a list of local users as list of usernames.
A user account is considered local if the length of it’s password is
greater then zero.
Sourcepub async fn origin(&self, user_id: &UserId) -> Result<String>
pub async fn origin(&self, user_id: &UserId) -> Result<String>
Returns the origin of the user (password/LDAP/…).
Sourcepub async fn has_password(&self, user_id: &UserId) -> Result<bool>
pub async fn has_password(&self, user_id: &UserId) -> Result<bool>
Returns whether the user has a password. Disabled accounts and registrations setting a sentinel password will return false here.
Sourcepub async fn password_hash(&self, user_id: &UserId) -> Result<String>
pub async fn password_hash(&self, user_id: &UserId) -> Result<String>
Returns the password hash for the given user.
Sourcepub async fn set_password(
&self,
user_id: &UserId,
password: Option<&str>,
) -> Result
pub async fn set_password( &self, user_id: &UserId, password: Option<&str>, ) -> Result
Hashes and stores the user’s password.
A real password is hashed at the configured Argon2id cost and marks the
account as password-origin. None stores the disabled marker and the
sentinel is stored verbatim; neither is hashed. Changing the password of
an account whose origin is neither password nor SSO is rejected.
Sourcepub fn create_filter(
&self,
user_id: &UserId,
filter: &FilterDefinition,
) -> String
pub fn create_filter( &self, user_id: &UserId, filter: &FilterDefinition, ) -> String
Creates a new sync filter. Returns the filter id.
pub async fn get_filter( &self, user_id: &UserId, filter_id: &str, ) -> Result<FilterDefinition>
Sourcepub fn create_openid_token(&self, user_id: &UserId, token: &str) -> Result<u64>
pub fn create_openid_token(&self, user_id: &UserId, token: &str) -> Result<u64>
Creates an OpenID token, which can be used to prove that a user has access to an account (primarily for integrations)
Sourcepub async fn find_from_openid_token(&self, token: &str) -> Result<OwnedUserId>
pub async fn find_from_openid_token(&self, token: &str) -> Result<OwnedUserId>
Find out which user an OpenID access token belongs to.
Sourcepub fn create_login_token(&self, user_id: &UserId, token: &str) -> u64
pub fn create_login_token(&self, user_id: &UserId, token: &str) -> u64
Creates a short-lived login token, which can be used to log in using the
m.login.token mechanism.
Sourcepub async fn peek_login_token(&self, token: &str) -> Result<OwnedUserId>
pub async fn peek_login_token(&self, token: &str) -> Result<OwnedUserId>
Verify a login token is valid and return its owner without consuming it.
Unlike find_from_login_token, the token remains in the database
after this call and can still be consumed later.
Sourcepub async fn find_from_login_token(&self, token: &str) -> Result<OwnedUserId>
pub async fn find_from_login_token(&self, token: &str) -> Result<OwnedUserId>
Find out which user a login token belongs to. Removes the token to prevent double-use attacks.
Trait Implementations§
Source§impl Service for Service
impl Service for Service
Source§fn build(args: &Args<'_>) -> Result<Arc<Self>>
fn build(args: &Args<'_>) -> Result<Arc<Self>>
Source§fn name(&self) -> &str
fn name(&self) -> &str
crate::service::make_name(std::module_path!())Source§fn worker<'async_trait>(
self: Arc<Self>,
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>>where
Self: 'async_trait,
fn worker<'async_trait>(
self: Arc<Self>,
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>>where
Self: 'async_trait,
Source§fn interrupt<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn interrupt<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn clear_cache<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn clear_cache<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn memory_usage<'life0, 'life1, 'async_trait>(
&'life0 self,
_out: &'life1 mut (dyn Write + Send),
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn memory_usage<'life0, 'life1, 'async_trait>(
&'life0 self,
_out: &'life1 mut (dyn Write + Send),
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn unconstrained(&self) -> bool
fn unconstrained(&self) -> bool
Auto Trait Implementations§
impl !RefUnwindSafe for Service
impl !UnwindSafe for Service
impl Freeze for Service
impl Send for Service
impl Sync for Service
impl Unpin for Service
impl UnsafeUnpin for Service
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ExpectInto for T
impl<T> ExpectInto for T
Source§impl<T> Expected for T
impl<T> Expected for T
Source§fn expected_add(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedAdd,
fn expected_add(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedAdd,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_sub(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedSub,
fn expected_sub(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedSub,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_mul(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedMul,
fn expected_mul(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedMul,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_div(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedDiv,
fn expected_div(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedDiv,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_rem(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedRem,
fn expected_rem(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedRem,
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreimpl<T> JsonCastable<CanonicalJsonValue> for T
impl<T> JsonCastable<Value> for T
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
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 bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
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>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
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 rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
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 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.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
§fn whenever(&self, value: Condition) -> Painted<&T>
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);§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
§fn compression(self) -> Compression<Self>where
Self: Sized,
fn compression(self) -> Compression<Self>where
Self: Sized,
§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<Self>where
Self: Sized,
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
§fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
§fn sensitive_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>where
Self: Sized,
fn sensitive_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>where
Self: Sized,
§fn sensitive_request_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<Self>where
Self: Sized,
fn sensitive_request_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<Self>where
Self: Sized,
§fn sensitive_response_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveResponseHeaders<Self>where
Self: Sized,
fn sensitive_response_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveResponseHeaders<Self>where
Self: Sized,
§fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
500 Internal Server responses. Read moreSource§impl<T> Tried for T
impl<T> Tried for T
Source§fn try_add(self, rhs: Self) -> Result<Self, Error>where
Self: Sized + CheckedAdd,
fn try_add(self, rhs: Self) -> Result<Self, Error>where
Self: Sized + CheckedAdd,
rhs with checked arithmetic. Read moreSource§fn try_sub(self, rhs: Self) -> Result<Self, Error>where
Self: Sized + CheckedSub,
fn try_sub(self, rhs: Self) -> Result<Self, Error>where
Self: Sized + CheckedSub,
rhs with checked arithmetic. Read moreSource§fn try_mul(self, rhs: Self) -> Result<Self, Error>where
Self: Sized + CheckedMul,
fn try_mul(self, rhs: Self) -> Result<Self, Error>where
Self: Sized + CheckedMul,
rhs with checked arithmetic. Read more