pub struct Service {
services: Arc<OnceServices>,
db: Data,
}Fields§
§services: Arc<OnceServices>§db: DataImplementations§
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 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.
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 the access token without deleting the device. Take care to not leave dangling devices if using this method.
Source§impl Service
impl Service
pub async fn get_access_token( &self, user_id: &UserId, device_id: &DeviceId, ) -> Result<String>
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
pub async fn get_refresh_token( &self, user_id: &UserId, device_id: &DeviceId, ) -> Result<String>
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, )
Source§impl Service
impl Service
pub fn put_device_metadata( &self, user_id: &UserId, notify: bool, device: &Device, )
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
pub async fn add_one_time_keys<'a, Keys>( &self, user_id: &UserId, device_id: &DeviceId, keys: Keys, ) -> Result
Source§impl Service
impl Service
pub async fn add_one_time_key( &self, user_id: &UserId, device_id: &DeviceId, one_time_key_key: &KeyId<OneTimeKeyAlgorithm, OneTimeKeyName>, one_time_key_value: &Raw<OneTimeKey>, ) -> 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 add_fallback_key( &self, user_id: &UserId, device_id: &DeviceId, one_time_key_key: &KeyId<OneTimeKeyAlgorithm, OneTimeKeyName>, one_time_key_value: &Raw<OneTimeKey>, ) -> 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
pub async fn add_device_keys( &self, user_id: &UserId, device_id: &DeviceId, device_keys: &Raw<DeviceKeys>, )
Source§impl Service
impl Service
pub async fn mark_device_key_update(&self, user_id: &UserId)
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
pub async fn update_displayname( &self, user_id: &UserId, displayname: Option<&str>, rooms: &[OwnedRoomId], propagation: Propagation, )
Source§impl Service
impl Service
Sourcepub fn set_displayname(&self, user_id: &UserId, displayname: Option<&str>)
pub fn set_displayname(&self, user_id: &UserId, displayname: Option<&str>)
Sets a new displayname or removes it if displayname is None. You still need to notify all rooms of this change.
Source§impl Service
impl Service
Sourcepub async fn displayname(&self, user_id: &UserId) -> Result<String>
pub async fn displayname(&self, user_id: &UserId) -> Result<String>
Returns the displayname of a user on this homeserver.
Source§impl Service
impl Service
pub async fn update_avatar_url( &self, user_id: &UserId, avatar_url: Option<&MxcUri>, blurhash: Option<&str>, rooms: &[OwnedRoomId], propagation: Propagation, )
Source§impl Service
impl Service
Sourcepub fn set_avatar_url(&self, user_id: &UserId, avatar_url: Option<&MxcUri>)
pub fn set_avatar_url(&self, user_id: &UserId, avatar_url: Option<&MxcUri>)
Sets a new avatar_url or removes it if avatar_url is None.
Source§impl Service
impl Service
Sourcepub async fn avatar_url(&self, user_id: &UserId) -> Result<OwnedMxcUri>
pub async fn avatar_url(&self, user_id: &UserId) -> Result<OwnedMxcUri>
Get the avatar_url of a user.
Source§impl Service
impl Service
Sourcepub fn set_blurhash(&self, user_id: &UserId, blurhash: Option<&str>)
pub fn set_blurhash(&self, user_id: &UserId, blurhash: Option<&str>)
Sets a new avatar_url or removes it if avatar_url is None.
Source§impl Service
impl Service
Sourcepub fn set_timezone(&self, user_id: &UserId, timezone: Option<&str>)
pub fn set_timezone(&self, user_id: &UserId, timezone: Option<&str>)
Sets a new timezone or removes it if timezone is None.
Source§impl Service
impl Service
Sourcepub fn all_profile_keys<'a>(
&'a self,
user_id: &'a UserId,
) -> impl Stream<Item = (String, Raw<ProfileFieldValue>)> + 'a + Send
pub fn all_profile_keys<'a>( &'a self, user_id: &'a UserId, ) -> impl Stream<Item = (String, Raw<ProfileFieldValue>)> + 'a + Send
Gets all the user’s profile keys and values in an iterator
Source§impl Service
impl Service
Sourcepub fn set_profile_key(
&self,
user_id: &UserId,
profile_key: &str,
profile_key_value: Option<&Value>,
)
pub fn set_profile_key( &self, user_id: &UserId, profile_key: &str, profile_key_value: Option<&Value>, )
Sets a new profile key value, removes the key if value is None
Source§impl Service
impl Service
Sourcepub async fn profile_key(
&self,
user_id: &UserId,
profile_key: &str,
) -> Result<Raw<ProfileFieldValue>>
pub async fn profile_key( &self, user_id: &UserId, profile_key: &str, ) -> Result<Raw<ProfileFieldValue>>
Gets a specific user profile key
Source§impl Service
impl Service
Sourceasync fn member_displayname(
&self,
room_id: &RoomId,
user_id: &UserId,
) -> Option<String>
async fn member_displayname( &self, room_id: &RoomId, user_id: &UserId, ) -> Option<String>
Current per-room displayname for the user, or None if the room has
no member event for them.
Source§impl Service
impl Service
Sourceasync fn member_avatar_url(
&self,
room_id: &RoomId,
user_id: &UserId,
) -> Option<OwnedMxcUri>
async fn member_avatar_url( &self, room_id: &RoomId, user_id: &UserId, ) -> Option<OwnedMxcUri>
Current per-room avatar_url for the user, or None if the room has
no member event for them.
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 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 invites_blocked(&self, user_id: &UserId) -> bool
pub async fn invites_blocked(&self, user_id: &UserId) -> bool
MSC4380: m.invite_permission_config.default_action == "block".
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 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 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 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).
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)
pub fn set_locked(&self, user_id: &UserId, by: &UserId)
pub fn clear_locked(&self, user_id: &UserId)
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
Hash and set the user’s password to the Argon2 hash
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.
async fn update_all_rooms<'a, S>(&self, user_id: &UserId, rooms: S)where
S: Stream<Item = (PduBuilder, &'a OwnedRoomId)> + Send,
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 Freeze for Service
impl !RefUnwindSafe for Service
impl Send for Service
impl Sync for Service
impl Unpin for Service
impl UnsafeUnpin for Service
impl !UnwindSafe 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
fn expect_into<Dst>(self) -> Dst
Source§impl<T> Expected for T
impl<T> Expected for T
fn expected_add(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedAdd,
fn expected_sub(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedSub,
fn expected_mul(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedMul,
fn expected_div(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedDiv,
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>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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 more§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 more