pub struct Service {
pub mutex: MutexMap<OwnedRoomId, ()>,
services: Arc<OnceServices>,
db: Data,
}Expand description
Manages current room state, event state snapshots, and forward extremities.
State mutations are serialized per room and delegated to the compressor for persistent delta encoding. The service also coordinates cache updates that follow forced state changes.
Fields§
§mutex: MutexMap<OwnedRoomId, ()>Serializes room state as the middle per-room operation.
Acquire it after federation and before timeline insertion when those mutexes share a room. Never acquire the federation mutex while holding this guard.
services: Arc<OnceServices>§db: DataImplementations§
Source§impl Service
impl Service
Sourcepub async fn prune_forward_extremities(
&self,
room_id: &RoomId,
extremities: &mut Vec<OwnedEventId>,
goal: usize,
trigger: Trigger,
) -> PruneSummary
pub async fn prune_forward_extremities( &self, room_id: &RoomId, extremities: &mut Vec<OwnedEventId>, goal: usize, trigger: Trigger, ) -> PruneSummary
Prunes the least useful leaves from a room’s forward-extremity candidates.
Dangling leaves and, for an administrative pass, referenced leaves are removed before the requested goal is charged. The selection never removes a local-server leaf and never empties a nonempty supplied vector; persistence remains the caller’s responsibility.
Source§impl Service
impl Service
async fn classify_extremities( &self, room_id: &RoomId, extremities: &[OwnedEventId], trigger: Trigger, ) -> Vec<Candidate<OwnedEventId>>
Source§impl Service
impl Service
async fn classify_leaf( &self, room_id: &RoomId, event_id: &EventId, trigger: Trigger, ) -> Partial
Source§impl Service
impl Service
Sourcepub async fn force_state(
&self,
room_id: &RoomId,
shortstatehash: u64,
statediffnew: Arc<CompressedState>,
_statediffremoved: Arc<CompressedState>,
state_lock: &RoomMutexGuard,
) -> Result
pub async fn force_state( &self, room_id: &RoomId, shortstatehash: u64, statediffnew: Arc<CompressedState>, _statediffremoved: Arc<CompressedState>, state_lock: &RoomMutexGuard, ) -> Result
Forces a room to use an existing state snapshot.
Resolvable membership additions replay their cache effects before the current state hash is installed. Reverse-ID and PDU lookup failures are skipped, while a membership-effect error returns before the state hash changes. Joined counts are refreshed and the cached space summary is invalidated while the caller retains the room state guard.
Source§impl Service
impl Service
Sourcepub(crate) async fn prepare_force_state(
&self,
room_id: &RoomId,
statediffnew: &CompressedState,
_state_lock: &RoomMutexGuard,
) -> Result
pub(crate) async fn prepare_force_state( &self, room_id: &RoomId, statediffnew: &CompressedState, _state_lock: &RoomMutexGuard, ) -> Result
Replays membership additions before installing a forced state snapshot.
Lookup failures are skipped; membership-effect errors propagate before joined counts are refreshed. The caller retains the room state guard through preparation and installation.
Source§impl Service
impl Service
Sourcepub(crate) fn install_force_state(
&self,
room_id: &RoomId,
shortstatehash: u64,
state_lock: &RoomMutexGuard,
)
pub(crate) fn install_force_state( &self, room_id: &RoomId, shortstatehash: u64, state_lock: &RoomMutexGuard, )
Installs a prepared state snapshot and invalidates its hierarchy summary.
Preparation and any required timeline append must have succeeded under the same room state guard before installation.
Source§impl Service
impl Service
Sourceasync fn force_member_effects(&self, room_id: &RoomId, pdu: &PduEvent) -> Result
async fn force_member_effects(&self, room_id: &RoomId, pdu: &PduEvent) -> Result
Record the membership transition a replayed m.room.member event carries.
A replayed invite is judged by the sender named in its stripped state, so a local invitee’s row has to carry one. An event whose state key or content does not parse is skipped rather than failing the whole replay.
Source§impl Service
impl Service
Sourceasync fn replayed_invite_state(
&self,
room_id: &RoomId,
user_id: &UserId,
pdu: &PduEvent,
) -> Result<StrippedRoomState>
async fn replayed_invite_state( &self, room_id: &RoomId, user_id: &UserId, pdu: &PduEvent, ) -> Result<StrippedRoomState>
Computes stripped state for a replayed invite, unless the row has some.
A reset reaches this before the new state is installed, so the summary built
here is thinner than what the invite itself stored. Returning nothing leaves
the stored row for mark_as_invited to keep. A probe that fails to read
the row is an error, not an absence.
Source§impl Service
impl Service
Sourcepub async fn set_event_state(
&self,
event_id: &EventId,
room_id: &RoomId,
state_ids_compressed: Arc<CompressedState>,
) -> Result<ShortStateHash>
pub async fn set_event_state( &self, event_id: &EventId, room_id: &RoomId, state_ids_compressed: Arc<CompressedState>, ) -> Result<ShortStateHash>
Associates an event with a complete compressed state snapshot.
The snapshot hash is reused when known; otherwise a short state hash and a delta from the room’s current snapshot are stored together. This records the event’s state without advancing the room’s current state.
Source§impl Service
impl Service
Sourcepub async fn shortstatehash_after_event<Pdu: Event>(
&self,
pdu: &Pdu,
) -> Result<ShortStateHash>
pub async fn shortstatehash_after_event<Pdu: Event>( &self, pdu: &Pdu, ) -> Result<ShortStateHash>
Returns the snapshot after an event: its own snapshot with the event applied.
An event’s recorded snapshot precedes it. A state event replaces the entry under its state key, and the result is stored by hash as a delta from that snapshot, so a repeated call reuses it. Any other event returns its snapshot unchanged.
Source§impl Service
impl Service
Sourceasync fn state_entry_change<Pdu: Event>(
&self,
pdu: &Pdu,
state_key: &str,
full_state: Option<&CompressedState>,
) -> (CompressedStateEvent, Option<CompressedStateEvent>)
async fn state_entry_change<Pdu: Event>( &self, pdu: &Pdu, state_key: &str, full_state: Option<&CompressedState>, ) -> (CompressedStateEvent, Option<CompressedStateEvent>)
Compresses a state event and finds the entry under its key in a snapshot.
The event’s short IDs are allocated when absent, so the compressed entry is ready to store; a snapshot holds at most one entry under a key.
Source§impl Service
impl Service
Sourceasync fn store_snapshot(
&self,
state_hash: &Digest,
parents: Vec<ShortStateInfo>,
delta: impl FnOnce() -> (Arc<CompressedState>, Arc<CompressedState>) + Send,
) -> Result<ShortStateHash>
async fn store_snapshot( &self, state_hash: &Digest, parents: Vec<ShortStateInfo>, delta: impl FnOnce() -> (Arc<CompressedState>, Arc<CompressedState>) + Send, ) -> Result<ShortStateHash>
Stores a snapshot under its hash as a delta from its parents, unless known.
The delta is built only when the snapshot is new. Nothing is based on it in turn, so it never becomes a parent itself.
Source§impl Service
impl Service
Sourcepub async fn append_to_state(&self, new_pdu: &PduEvent) -> Result<u64>
pub async fn append_to_state(&self, new_pdu: &PduEvent) -> Result<u64>
Derives the state snapshot produced by appending a local PDU.
The event is associated with the preceding snapshot before a state event creates a one-entry delta and a new short state hash. A non-state event retains the preceding hash, and an unchanged state event reuses it. The event’s short ID is allocated here if absent, which is the only allocation of it on the local append path.
§Panics
Panics if a room’s first event is not state-bearing or if an unchanged state entry is found without a preceding room snapshot.
Source§impl Service
impl Service
Sourcepub fn set_room_state(
&self,
room_id: &RoomId,
shortstatehash: u64,
_mutex_lock: &RoomMutexGuard,
)
pub fn set_room_state( &self, room_id: &RoomId, shortstatehash: u64, _mutex_lock: &RoomMutexGuard, )
Sets the room’s current state hash without updating derived state caches.
The guard proves that the caller owns the room state mutation path. Callers that change effective state must update the relevant caches separately.
Source§impl Service
impl Service
Sourcepub async fn get_auth_events(
&self,
room_id: &RoomId,
kind: &TimelineEventType,
sender: &UserId,
state_key: Option<&str>,
content: &RawValue,
auth_rules: &AuthorizationRules,
include_create: bool,
) -> Result<StateMap<PduEvent>>
pub async fn get_auth_events( &self, room_id: &RoomId, kind: &TimelineEventType, sender: &UserId, state_key: Option<&str>, content: &RawValue, auth_rules: &AuthorizationRules, include_create: bool, ) -> Result<StateMap<PduEvent>>
Fetches the auth events required from a room’s current state.
The required state keys are derived from the proposed event and room authorization rules. A room without current state yields an empty map, and missing short-key mappings or stored PDUs are omitted.
Source§impl Service
impl Service
Sourcepub async fn summary_stripped<Pdu: Event>(
&self,
event: &Pdu,
) -> Vec<Raw<AnyStrippedStateEvent>>
pub async fn summary_stripped<Pdu: Event>( &self, event: &Pdu, ) -> Vec<Raw<AnyStrippedStateEvent>>
Builds stripped invite-state context for a membership event.
Recommended room state cells are fetched on a best-effort basis, then the supplied membership event is appended last. A cell absent from the current state is skipped, which is every cell before a room’s first snapshot; any other failed lookup is logged and omitted.
Source§impl Service
impl Service
Sourceasync fn summary_state_event(
&self,
room_id: &RoomId,
cell: (&'_ StateEventType, &'_ str),
) -> Option<PduEvent>
async fn summary_state_event( &self, room_id: &RoomId, cell: (&'_ StateEventType, &'_ str), ) -> Option<PduEvent>
Reads one recommended cell of the room’s current state.
The cell’s lookup and its event read are separate steps because both report a miss the same way, and only the first of those is an absent cell.
Source§impl Service
impl Service
Sourcepub async fn summary_pdus<Pdu: Event>(
&self,
event: &Pdu,
event_json: &CanonicalJsonObject,
room_version: &RoomVersionId,
) -> Vec<Box<RawJsonValue>>
pub async fn summary_pdus<Pdu: Event>( &self, event: &Pdu, event_json: &CanonicalJsonObject, room_version: &RoomVersionId, ) -> Vec<Box<RawJsonValue>>
Builds full-PDU invite-state context for a membership event.
Recommended stored state and the supplied event are formatted for the given room version as required by MSC4311. A recommended event absent from the current state is skipped; any other failed lookup, including an event the state references but storage cannot read as a PDU, is logged and omitted. The supplied membership event is appended last.
Source§impl Service
impl Service
async fn summary_state_pdu( &self, room_id: &RoomId, shortstatehash: ShortStateHash, cell: (&'_ StateEventType, &'_ str), room_version: &RoomVersionId, ) -> Option<Box<RawJsonValue>>
Source§impl Service
impl Service
Sourcepub async fn get_room_version_rules(
&self,
room_id: &RoomId,
) -> Result<RoomVersionRules>
pub async fn get_room_version_rules( &self, room_id: &RoomId, ) -> Result<RoomVersionRules>
Returns the authorization and event-format rules for a room.
The rules are selected from the room version declared by its create event.
Source§impl Service
impl Service
Sourcepub async fn get_room_version(&self, room_id: &RoomId) -> Result<RoomVersionId>
pub async fn get_room_version(&self, room_id: &RoomId) -> Result<RoomVersionId>
Returns the room version declared by the room’s create event.
Only the event’s content is decoded, so a create event stored without its room ID still yields the version. An unreadable accepted event falls back to outlier storage. Transient storage errors are preserved when neither copy can be read.
Source§impl Service
impl Service
Sourcepub(crate) async fn room_version_checked(
&self,
room_id: &RoomId,
) -> Result<Mapped<RoomVersionId>>
pub(crate) async fn room_version_checked( &self, room_id: &RoomId, ) -> Result<Mapped<RoomVersionId>>
Returns the room version as Service::get_room_version does, resolving the
room’s state and the create event’s timeline mapping untrusted.
Damage from the room’s state pointer to the create event’s timeline mapping is
Mapped::Damaged where that function panics, fails or reads a prefix, and the
state is rebuilt from storage alone. The accepted copy of the create event is
read before the outlier, as there. Unlike that function, only a read finding
no row or one that does not decode reports no create event, so any other
failure, a database pool failure included, is returned as itself, the accepted
copy’s kept over the outlier’s.
Source§impl Service
impl Service
Sourcepub async fn get_room_shortstatehash(
&self,
room_id: &RoomId,
) -> Result<ShortStateHash>
pub async fn get_room_shortstatehash( &self, room_id: &RoomId, ) -> Result<ShortStateHash>
Returns the short hash of a room’s current state snapshot.
The lookup reads only the current room-to-state mapping and does not reconstruct the snapshot.
Source§impl Service
impl Service
Sourcepub async fn pdu_shortstatehash(
&self,
event_id: &EventId,
) -> Result<ShortStateHash>
pub async fn pdu_shortstatehash( &self, event_id: &EventId, ) -> Result<ShortStateHash>
Returns the state hash recorded for an event.
The event ID is first resolved to its short event ID before the snapshot association is read.
Source§impl Service
impl Service
Sourcepub async fn get_shortstatehash(
&self,
shorteventid: ShortEventId,
) -> Result<ShortStateHash>
pub async fn get_shortstatehash( &self, shorteventid: ShortEventId, ) -> Result<ShortStateHash>
Returns the state hash recorded for a short event ID.
This is the direct lookup used after an event ID has already been shortened.
Source§impl Service
impl Service
Sourcepub(super) fn delete_room_shortstatehash(
&self,
room_id: &RoomId,
_mutex_lock: &Guard<OwnedRoomId, ()>,
) -> Result
pub(super) fn delete_room_shortstatehash( &self, room_id: &RoomId, _mutex_lock: &Guard<OwnedRoomId, ()>, ) -> Result
Deletes a room’s current state-hash mapping.
The supplied guard proves exclusive access to the room state mutation path; compressed snapshots and event associations remain stored.
Source§impl Service
impl Service
Sourcepub async fn collapse_forward_extremities(
&self,
room_id: &RoomId,
state_lock: &RoomMutexGuard,
) -> usize
pub async fn collapse_forward_extremities( &self, room_id: &RoomId, state_lock: &RoomMutexGuard, ) -> usize
Collapses a room to the resolvable forward extremity latest in stream order.
Rooms with at most one leaf, or with no leaf that resolves to a timeline count, are left unchanged. The return value is the number of leaves removed.
Source§impl Service
impl Service
Sourcepub fn get_forward_extremities<'a>(
&'a self,
room_id: &'a RoomId,
) -> impl Stream<Item = &EventId> + Send + '_
pub fn get_forward_extremities<'a>( &'a self, room_id: &'a RoomId, ) -> impl Stream<Item = &EventId> + Send + '_
Streams the event IDs currently stored as a room’s forward extremities.
Invalid rows and cursor errors are omitted. Returned references borrow the database cursor and must be owned before they are retained across another poll.
Source§impl Service
impl Service
Sourcepub async fn set_forward_extremities<'a, I>(
&'a self,
room_id: &'a RoomId,
event_ids: I,
_state_lock: &'a RoomMutexGuard,
)
pub async fn set_forward_extremities<'a, I>( &'a self, room_id: &'a RoomId, event_ids: I, _state_lock: &'a RoomMutexGuard, )
Replaces all stored forward extremities for a room.
Deletions and insertions commit in one write batch while the caller holds the state guard. Errors encountered while scanning old rows are ignored.
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 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 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 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