pub struct Pdu {Show 14 fields
pub kind: TimelineEventType,
pub content: Content,
pub event_id: OwnedEventId,
pub room_id: OwnedRoomId,
pub sender: OwnedUserId,
pub state_key: Option<StateKey>,
pub redacts: Option<OwnedEventId>,
pub prev_events: PrevEvents,
pub auth_events: AuthEvents,
pub origin_server_ts: UInt,
pub depth: UInt,
pub hashes: EventHash,
pub origin: Option<OwnedServerName>,
pub unsigned: Option<Unsigned>,
}Expand description
Stores a Matrix persistent data unit in typed form.
The representation retains canonical event fields used by state resolution, storage, and client serialization. Federation adapters normalize version-specific wire shapes.
Fields§
§kind: TimelineEventTypeMatrix event type.
The value is serialized under the top-level type field.
content: ContentRaw canonical event content.
Content remains encoded until a caller requests a typed or JSON value.
event_id: OwnedEventIdMatrix identifier assigned to this event.
Stored PDUs always carry an owned event ID, including room versions that derive it outside the federation wire object.
room_id: OwnedRoomIdMatrix room containing this event.
Stored PDUs carry the room ID even when a room version omits it from a creation event’s federation representation.
sender: OwnedUserIdMatrix user who sent the event.
The sender participates in authorization and client-visible event output.
state_key: Option<StateKey>State key when this is a state event.
Message-like events store None and omit the field during
serialization.
redacts: Option<OwnedEventId>Event targeted by a redaction when carried at the top level.
Newer room versions can place this value in event content instead. An absent target is omitted during serialization.
prev_events: PrevEventsEvents declared as direct predecessors of this event.
The sequence is stored inline for the common single-predecessor case.
auth_events: AuthEventsEvents used to authorize this event.
These identifiers form the event’s explicit authorization dependency set.
origin_server_ts: UIntMillisecond timestamp supplied by the originating server.
The value is preserved for ordering metadata and client serialization.
depth: UIntEvent depth in the room directed acyclic graph.
Depth is originating-server-provided graph metadata and is distinct from the local timeline sequence.
hashes: EventHashContent hash declared by the event.
Federation validation compares the declaration with the computed content hash to detect content changes.
origin: Option<OwnedServerName>Server that originated an event carrying a top-level origin field.
Legacy event formats retain this value for local and remote events. The field is absent when it was not carried by the event format.
unsigned: Option<Unsigned>Unsigned metadata excluded from event hashing and signing.
Stored values are local annotations such as transaction IDs, age, prior state, and bundled relations. The field is omitted when absent.
Implementations§
Source§impl Pdu
impl Pdu
Sourcepub fn remove_transaction_id(&mut self) -> Result
pub fn remove_transaction_id(&mut self) -> Result
Removes the local transaction ID from unsigned event metadata.
Other unsigned properties are retained and the object is re-encoded. An event without unsigned data is left unchanged.
Source§impl Pdu
impl Pdu
Sourcepub fn remove_prev_state(&mut self) -> Result
pub fn remove_prev_state(&mut self) -> Result
State-section serving strips the stored prev_content/prev_sender
pair, dropping unsigned entirely when emptied; timeline serving keeps
the trio.
Source§impl Pdu
impl Pdu
Sourcepub fn add_membership(&mut self, membership: &MembershipState) -> Result
pub fn add_membership(&mut self, membership: &MembershipState) -> Result
MSC4115: annotate the served event with the requesting user’s room membership at the time of the event.
Source§impl Pdu
impl Pdu
Sourcepub fn set_thread_participated(&mut self, participated: bool) -> Result
pub fn set_thread_participated(&mut self, participated: bool) -> Result
MSC3816: overwrite unsigned.m.relations.m.thread.current_user_participated
with a per-requester value. No-op when the event carries no thread bundle.
Source§impl Pdu
impl Pdu
Sourcepub fn thread_latest_event(&self) -> Option<(OwnedEventId, OwnedUserId)>
pub fn thread_latest_event(&self) -> Option<(OwnedEventId, OwnedUserId)>
MSC4025: identify the bundled m.thread latest_event without parsing
the whole bundle: the sender keys the erasure gate, the event_id loads
the event on a hit.
Source§impl Pdu
impl Pdu
Sourcepub fn set_thread_latest_event(
&mut self,
latest: &Raw<AnySyncMessageLikeEvent>,
) -> Result
pub fn set_thread_latest_event( &mut self, latest: &Raw<AnySyncMessageLikeEvent>, ) -> Result
MSC4025: overwrite unsigned.m.relations.m.thread.latest_event, serving
the pruned form of an erased sender’s thread activity. No-op when the
event carries no thread bundle.
Source§impl Pdu
impl Pdu
Sourcepub fn set_thread_count(&mut self, count: usize) -> Result
pub fn set_thread_count(&mut self, count: usize) -> Result
MSC3856: overwrite unsigned.m.relations.m.thread.count with a
per-requester value excluding ignored senders’ replies. No-op when the
event carries no thread bundle.
Source§impl Pdu
impl Pdu
Sourcepub fn set_replacement_bundle(
&mut self,
replacement: &Raw<AnySyncMessageLikeEvent>,
) -> Result
pub fn set_replacement_bundle( &mut self, replacement: &Raw<AnySyncMessageLikeEvent>, ) -> Result
MSC3925: fold the newest m.replace edit into
unsigned.m.relations.m.replace as the full replacement event, preserving
an existing bundle such as m.thread and creating unsigned when absent.
Source§impl Pdu
impl Pdu
Sourcepub fn remove_replacement_bundle(&mut self) -> Result
pub fn remove_replacement_bundle(&mut self) -> Result
Inverse of set_replacement_bundle: excise m.replace from
unsigned.m.relations, dropping m.relations when the excision empties
it and unsigned when that leaves nothing.
Source§impl Pdu
impl Pdu
Sourcepub fn set_reference_bundle(&mut self, event_ids: &[OwnedEventId]) -> Result
pub fn set_reference_bundle(&mut self, event_ids: &[OwnedEventId]) -> Result
MSC2675/MSC3267: fold reference relations into
unsigned.m.relations.m.reference as { chunk: [{ event_id }, ...] },
preserving an existing bundle such as m.thread or m.replace and creating
unsigned when absent.
Source§impl Pdu
impl Pdu
Sourcepub fn from_object_and_roomid_and_eventid(
room_id: &RoomId,
event_id: &EventId,
json: CanonicalJsonObject,
) -> Result<Self>
pub fn from_object_and_roomid_and_eventid( room_id: &RoomId, event_id: &EventId, json: CanonicalJsonObject, ) -> Result<Self>
Inserts room and event IDs before deserializing a canonical PDU object.
Existing values under those keys are replaced. The resulting typed PDU owns both supplied identifiers.
Sourcepub fn from_object_and_eventid(
event_id: &EventId,
json: CanonicalJsonObject,
) -> Result<Self>
pub fn from_object_and_eventid( event_id: &EventId, json: CanonicalJsonObject, ) -> Result<Self>
Inserts an event ID before deserializing a canonical PDU object.
Any existing event_id value is replaced. Other object fields pass
through to normal PDU deserialization.
Sourcepub fn from_object_federation(
room_id: &RoomId,
event_id: &EventId,
json: CanonicalJsonObject,
rules: &RoomVersionRules,
) -> Result<(Self, CanonicalJsonObject)>
pub fn from_object_federation( room_id: &RoomId, event_id: &EventId, json: CanonicalJsonObject, rules: &RoomVersionRules, ) -> Result<(Self, CanonicalJsonObject)>
Normalizes federation wire fields and validates PDU format and room ID.
Version-specific wire fields are converted to the stored representation before these checks. Signature, content-hash, and authorization validation remain the caller’s responsibility.
§Panics
Panics if the object lacks type while the selected rules do not
require a create-event room ID.
Sourcepub fn from_object_checked(
json: CanonicalJsonObject,
rules: &RoomVersionRules,
) -> Result<Self>
pub fn from_object_checked( json: CanonicalJsonObject, rules: &RoomVersionRules, ) -> Result<Self>
Validates a canonical PDU object before deserializing it.
Checks use the supplied room-version event-format rules. Successful validation returns the typed stored representation.
Sourcepub fn from_object(json: CanonicalJsonObject) -> Result<Self>
pub fn from_object(json: CanonicalJsonObject) -> Result<Self>
Deserializes a canonical JSON object into a stored PDU.
The object is wrapped as a canonical JSON value before typed deserialization. No room-version format checks are performed.
Sourcepub fn from_raw_value(json: &RawJsonValue) -> Result<Self>
pub fn from_raw_value(json: &RawJsonValue) -> Result<Self>
Deserializes raw JSON through a canonical JSON value.
Canonical conversion normalizes integer and object representation before the PDU fields are decoded. No room-version format checks are performed.
§Panics
Panics if the raw JSON contains a value outside canonical JSON, such as a floating-point value or an integer outside the canonical range.
Sourcepub fn from_value(json: CanonicalJsonValue) -> Result<Self>
pub fn from_value(json: CanonicalJsonValue) -> Result<Self>
Deserializes a canonical JSON value into a stored PDU.
The input must contain the fields required by Pdu. No room-version
format checks are performed before deserialization.
Sourcepub fn from_raw_json(json: &RawJsonValue) -> Result<Self>
pub fn from_raw_json(json: &RawJsonValue) -> Result<Self>
Deserializes raw JSON directly into a stored PDU.
This path uses Pdu’s Serde representation without first canonicalizing
the input. Callers that require canonical validation should use a
checked constructor.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Pdu
impl<'de> Deserialize<'de> for Pdu
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Pdu
Prevent derived equality which wouldn’t limit itself to event_id
Source§impl Event for Pdu
impl Event for Pdu
Source§fn auth_events(
&self,
) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_
fn auth_events( &self, ) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_
Source§fn auth_events_into(
self,
) -> impl IntoIterator<IntoIter = impl Iterator<Item = OwnedEventId>> + Send
fn auth_events_into( self, ) -> impl IntoIterator<IntoIter = impl Iterator<Item = OwnedEventId>> + Send
Source§fn content(&self) -> &RawJsonValue
fn content(&self) -> &RawJsonValue
Source§fn origin_server_ts(&self) -> MilliSecondsSinceUnixEpoch
fn origin_server_ts(&self) -> MilliSecondsSinceUnixEpoch
Source§fn prev_events(
&self,
) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_
fn prev_events( &self, ) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_
Source§fn redacts(&self) -> Option<&EventId>
fn redacts(&self) -> Option<&EventId>
Source§fn unsigned(&self) -> Option<&RawJsonValue>
fn unsigned(&self) -> Option<&RawJsonValue>
Source§fn as_mut_pdu(&mut self) -> &mut Pdu
fn as_mut_pdu(&mut self) -> &mut Pdu
Source§fn into_pdu(self) -> Pdu
fn into_pdu(self) -> Pdu
Source§fn is_owned(&self) -> bool
fn is_owned(&self) -> bool
Source§fn is_type_and_state_key(
&self,
kind: &TimelineEventType,
state_key: &str,
) -> bool
fn is_type_and_state_key( &self, kind: &TimelineEventType, state_key: &str, ) -> bool
Source§fn into_format<T>(self) -> T
fn into_format<T>(self) -> T
Source§fn contains_unsigned_property<T>(&self, property: &str, is_type: T) -> bool
fn contains_unsigned_property<T>(&self, property: &str, is_type: T) -> bool
Source§fn get_unsigned_property<T>(&self, property: &str) -> Result<T>where
T: for<'de> Deserialize<'de>,
Self: Sized,
fn get_unsigned_property<T>(&self, property: &str) -> Result<T>where
T: for<'de> Deserialize<'de>,
Self: Sized,
Source§fn get_unsigned_as_value(&self) -> JsonValuewhere
Self: Sized,
fn get_unsigned_as_value(&self) -> JsonValuewhere
Self: Sized,
Source§fn get_unsigned<T>(&self) -> Result<T>where
T: for<'de> Deserialize<'de>,
Self: Sized,
fn get_unsigned<T>(&self) -> Result<T>where
T: for<'de> Deserialize<'de>,
Self: Sized,
Source§fn get_content_as_value(&self) -> JsonValuewhere
Self: Sized,
fn get_content_as_value(&self) -> JsonValuewhere
Self: Sized,
Source§fn get_content<T>(&self) -> Result<T>where
for<'de> T: Deserialize<'de>,
Self: Sized,
fn get_content<T>(&self) -> Result<T>where
for<'de> T: Deserialize<'de>,
Self: Sized,
Source§fn redacts_id(&self, room_rules: &RoomVersionRules) -> Option<OwnedEventId>where
Self: Sized,
fn redacts_id(&self, room_rules: &RoomVersionRules) -> Option<OwnedEventId>where
Self: Sized,
Source§fn is_redacted(&self) -> boolwhere
Self: Sized,
fn is_redacted(&self) -> boolwhere
Self: Sized,
Source§fn into_canonical_object(self) -> CanonicalJsonObjectwhere
Self: Sized,
fn into_canonical_object(self) -> CanonicalJsonObjectwhere
Self: Sized,
Source§fn to_canonical_object(&self) -> CanonicalJsonObject
fn to_canonical_object(&self) -> CanonicalJsonObject
Source§fn into_value(self) -> JsonValuewhere
Self: Sized,
fn into_value(self) -> JsonValuewhere
Self: Sized,
Source§fn event_type(&self) -> &TimelineEventType
fn event_type(&self) -> &TimelineEventType
Source§impl Event for &Pduwhere
Self: Send,
impl Event for &Pduwhere
Self: Send,
Source§fn auth_events(
&self,
) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_
fn auth_events( &self, ) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_
Source§fn auth_events_into(
self,
) -> impl IntoIterator<IntoIter = impl Iterator<Item = OwnedEventId>> + Send
fn auth_events_into( self, ) -> impl IntoIterator<IntoIter = impl Iterator<Item = OwnedEventId>> + Send
Source§fn content(&self) -> &RawJsonValue
fn content(&self) -> &RawJsonValue
Source§fn origin_server_ts(&self) -> MilliSecondsSinceUnixEpoch
fn origin_server_ts(&self) -> MilliSecondsSinceUnixEpoch
Source§fn prev_events(
&self,
) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_
fn prev_events( &self, ) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_
Source§fn redacts(&self) -> Option<&EventId>
fn redacts(&self) -> Option<&EventId>
Source§fn unsigned(&self) -> Option<&RawJsonValue>
fn unsigned(&self) -> Option<&RawJsonValue>
Source§fn into_pdu(self) -> Pdu
fn into_pdu(self) -> Pdu
Source§fn is_owned(&self) -> bool
fn is_owned(&self) -> bool
Source§fn is_type_and_state_key(
&self,
kind: &TimelineEventType,
state_key: &str,
) -> bool
fn is_type_and_state_key( &self, kind: &TimelineEventType, state_key: &str, ) -> bool
Source§fn into_format<T>(self) -> T
fn into_format<T>(self) -> T
Source§fn contains_unsigned_property<T>(&self, property: &str, is_type: T) -> bool
fn contains_unsigned_property<T>(&self, property: &str, is_type: T) -> bool
Source§fn get_unsigned_property<T>(&self, property: &str) -> Result<T>where
T: for<'de> Deserialize<'de>,
Self: Sized,
fn get_unsigned_property<T>(&self, property: &str) -> Result<T>where
T: for<'de> Deserialize<'de>,
Self: Sized,
Source§fn get_unsigned_as_value(&self) -> JsonValuewhere
Self: Sized,
fn get_unsigned_as_value(&self) -> JsonValuewhere
Self: Sized,
Source§fn get_unsigned<T>(&self) -> Result<T>where
T: for<'de> Deserialize<'de>,
Self: Sized,
fn get_unsigned<T>(&self) -> Result<T>where
T: for<'de> Deserialize<'de>,
Self: Sized,
Source§fn get_content_as_value(&self) -> JsonValuewhere
Self: Sized,
fn get_content_as_value(&self) -> JsonValuewhere
Self: Sized,
Source§fn get_content<T>(&self) -> Result<T>where
for<'de> T: Deserialize<'de>,
Self: Sized,
fn get_content<T>(&self) -> Result<T>where
for<'de> T: Deserialize<'de>,
Self: Sized,
Source§fn redacts_id(&self, room_rules: &RoomVersionRules) -> Option<OwnedEventId>where
Self: Sized,
fn redacts_id(&self, room_rules: &RoomVersionRules) -> Option<OwnedEventId>where
Self: Sized,
Source§fn is_redacted(&self) -> boolwhere
Self: Sized,
fn is_redacted(&self) -> boolwhere
Self: Sized,
Source§fn into_canonical_object(self) -> CanonicalJsonObjectwhere
Self: Sized,
fn into_canonical_object(self) -> CanonicalJsonObjectwhere
Self: Sized,
Source§fn to_canonical_object(&self) -> CanonicalJsonObject
fn to_canonical_object(&self) -> CanonicalJsonObject
Source§fn into_value(self) -> JsonValuewhere
Self: Sized,
fn into_value(self) -> JsonValuewhere
Self: Sized,
Source§fn as_mut_pdu(&mut self) -> &mut Pdu
fn as_mut_pdu(&mut self) -> &mut Pdu
Source§fn event_type(&self) -> &TimelineEventType
fn event_type(&self) -> &TimelineEventType
Source§impl Ord for Pdu
Ordering determined by the Pdu’s ID, not the memory representations.
impl Ord for Pdu
Ordering determined by the Pdu’s ID, not the memory representations.
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Pdu
Ordering determined by the Pdu’s ID, not the memory representations.
impl PartialOrd for Pdu
Ordering determined by the Pdu’s ID, not the memory representations.
Auto Trait Implementations§
impl Freeze for Pdu
impl RefUnwindSafe for Pdu
impl Send for Pdu
impl Sync for Pdu
impl Unpin for Pdu
impl UnsafeUnpin for Pdu
impl UnwindSafe for Pdu
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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: CheckedAdd + Sized,
fn expected_add(self, rhs: Self) -> Selfwhere
Self: CheckedAdd + Sized,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_sub(self, rhs: Self) -> Selfwhere
Self: CheckedSub + Sized,
fn expected_sub(self, rhs: Self) -> Selfwhere
Self: CheckedSub + Sized,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_mul(self, rhs: Self) -> Selfwhere
Self: CheckedMul + Sized,
fn expected_mul(self, rhs: Self) -> Selfwhere
Self: CheckedMul + Sized,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_div(self, rhs: Self) -> Selfwhere
Self: CheckedDiv + Sized,
fn expected_div(self, rhs: Self) -> Selfwhere
Self: CheckedDiv + Sized,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_rem(self, rhs: Self) -> Selfwhere
Self: CheckedRem + Sized,
fn expected_rem(self, rhs: Self) -> Selfwhere
Self: CheckedRem + Sized,
§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> 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>where
Self: CheckedAdd + Sized,
fn try_add(self, rhs: Self) -> Result<Self>where
Self: CheckedAdd + Sized,
rhs with checked arithmetic. Read moreSource§fn try_sub(self, rhs: Self) -> Result<Self>where
Self: CheckedSub + Sized,
fn try_sub(self, rhs: Self) -> Result<Self>where
Self: CheckedSub + Sized,
rhs with checked arithmetic. Read moreSource§fn try_mul(self, rhs: Self) -> Result<Self>where
Self: CheckedMul + Sized,
fn try_mul(self, rhs: Self) -> Result<Self>where
Self: CheckedMul + Sized,
rhs with checked arithmetic. Read more