pub struct Service {
services: Arc<OnceServices>,
db: Data,
pub mutex_insert: MutexMap<OwnedRoomId, ()>,
}Fields§
§services: Arc<OnceServices>§db: Data§mutex_insert: MutexMap<OwnedRoomId, ()>Implementations§
Source§impl Service
impl Service
Sourcepub(crate) async fn append_incoming_pdu<'a, Leafs>(
&'a self,
pdu: &'a PduEvent,
pdu_json: CanonicalJsonObject,
new_room_leafs: Leafs,
state_ids_compressed: Arc<CompressedState>,
soft_fail: bool,
state_lock: &'a RoomMutexGuard,
) -> Result<Option<RawPduId>>
pub(crate) async fn append_incoming_pdu<'a, Leafs>( &'a self, pdu: &'a PduEvent, pdu_json: CanonicalJsonObject, new_room_leafs: Leafs, state_ids_compressed: Arc<CompressedState>, soft_fail: bool, state_lock: &'a RoomMutexGuard, ) -> Result<Option<RawPduId>>
Append the incoming event setting the state snapshot to the state from the server that sent the event.
Source§impl Service
impl Service
Sourcepub async fn append_pdu<'a, Leafs>(
&'a self,
pdu: &'a PduEvent,
pdu_json: CanonicalJsonObject,
leafs: Leafs,
state_lock: &'a RoomMutexGuard,
) -> Result<RawPduId>
pub async fn append_pdu<'a, Leafs>( &'a self, pdu: &'a PduEvent, pdu_json: CanonicalJsonObject, leafs: Leafs, state_lock: &'a RoomMutexGuard, ) -> Result<RawPduId>
Creates a new persisted data unit and adds it to a room.
By this point the incoming event should be fully authenticated, no auth
happens in append_pdu.
Returns pdu id
Source§impl Service
impl Service
async fn append_pdu_effects( &self, pdu_id: RawPduId, pdu: &PduEvent, shortroomid: ShortRoomId, count: PduCount, state_lock: &RoomMutexGuard, ) -> Result
Source§impl Service
impl Service
fn append_pdu_json( &self, pdu_id: &RawPduId, pdu: &PduEvent, json: &CanonicalJsonObject, )
Source§impl Service
impl Service
pub async fn backfill_if_required( &self, room_id: &RoomId, from: PduCount, ) -> Result
Source§impl Service
impl Service
pub async fn backfill_pdu( &self, room_id: &RoomId, origin: &ServerName, pdu: Box<RawJsonValue>, ) -> Result
Source§impl Service
impl Service
fn prepend_backfill_pdu( &self, pdu_id: &RawPduId, room_id: &RoomId, event_id: &EventId, origin_server_ts: u64, json: &CanonicalJsonObject, )
Source§impl Service
impl Service
Sourcepub async fn build_and_append_pdu(
&self,
pdu_builder: PduBuilder,
sender: &UserId,
room_id: &RoomId,
state_lock: &RoomMutexGuard,
) -> Result<OwnedEventId>
pub async fn build_and_append_pdu( &self, pdu_builder: PduBuilder, sender: &UserId, room_id: &RoomId, state_lock: &RoomMutexGuard, ) -> Result<OwnedEventId>
Creates a new persisted data unit and adds it to a room. This function takes a roomid_mutex_state, meaning that only this function is able to mutate the room state.
Source§impl Service
impl Service
async fn check_pdu_for_admin_room<Pdu>(
&self,
pdu: &Pdu,
sender: &UserId,
) -> Resultwhere
Pdu: Event,
Source§impl Service
impl Service
Sourceasync fn check_pdu_for_suspended_sender<Pdu>(&self, pdu: &Pdu) -> Resultwhere
Pdu: Event,
async fn check_pdu_for_suspended_sender<Pdu>(&self, pdu: &Pdu) -> Resultwhere
Pdu: Event,
MSC3823: reject PDUs from a suspended sender, except self-redaction of
their own event or self-leave. Synapse only checks membership == leave
and so lets suspended moderators kick others via /kick or a state PUT.
Source§impl Service
impl Service
pub async fn create_hash_and_sign_event( &self, pdu_builder: PduBuilder, sender: &UserId, room_id: &RoomId, _mutex_lock: &RoomMutexGuard, ) -> Result<(PduEvent, CanonicalJsonObject)>
Source§impl Service
impl Service
pub fn pdus_near_ts( &self, user_id: Option<&UserId>, room_id: &RoomId, ts: MilliSecondsSinceUnixEpoch, dir: Direction, ) -> impl Stream<Item = Result<PdusIterItem>> + Send
Source§impl Service
impl Service
pub fn pdu_ids_near_ts( &self, room_id: &RoomId, ts: MilliSecondsSinceUnixEpoch, dir: Direction, ) -> impl Stream<Item = Result<(MilliSecondsSinceUnixEpoch, PduId)>> + Send
Source§impl Service
impl Service
Sourcepub fn all_pdus<'a>(
&'a self,
user_id: &'a UserId,
room_id: &'a RoomId,
) -> impl Stream<Item = PdusIterItem> + Send + 'a
pub fn all_pdus<'a>( &'a self, user_id: &'a UserId, room_id: &'a RoomId, ) -> impl Stream<Item = PdusIterItem> + Send + 'a
Returns an iterator over all PDUs in a room. Unknown rooms produce no items.
Source§impl Service
impl Service
pub fn outlier_pdus_raw(&self) -> impl Stream<Item = Result<Val<'_>>> + Send
Source§impl Service
impl Service
fn each_slice( (pdu_id, pdu): KeyVal<'_>, user_id: Option<&UserId>, ) -> Result<PdusIterItem>
Source§impl Service
impl Service
Sourcepub async fn redact_pdu<Pdu: Event + Send + Sync>(
&self,
event_id: &EventId,
reason: &Pdu,
shortroomid: ShortRoomId,
state_lock: &RoomMutexGuard,
) -> Result
pub async fn redact_pdu<Pdu: Event + Send + Sync>( &self, event_id: &EventId, reason: &Pdu, shortroomid: ShortRoomId, state_lock: &RoomMutexGuard, ) -> Result
Replace a PDU with the redacted form.
Source§impl Service
impl Service
Sourcepub async fn replace_pdu(
&self,
pdu_id: &RawPduId,
pdu_json: &CanonicalJsonObject,
) -> Result
pub async fn replace_pdu( &self, pdu_id: &RawPduId, pdu_json: &CanonicalJsonObject, ) -> Result
Removes a pdu and creates a new one with the same id.
Source§impl Service
impl Service
pub fn add_pdu_outlier(&self, event_id: &EventId, pdu: &CanonicalJsonObject)
Source§impl Service
impl Service
pub async fn first_pdu_in_room(&self, room_id: &RoomId) -> Result<PduEvent>
Source§impl Service
impl Service
pub async fn latest_pdu_in_room(&self, room_id: &RoomId) -> Result<PduEvent>
Source§impl Service
impl Service
pub async fn first_item_in_room( &self, room_id: &RoomId, ) -> Result<(PduCount, PduEvent)>
Source§impl Service
impl Service
pub async fn latest_item_in_room( &self, sender_user: Option<&UserId>, room_id: &RoomId, ) -> Result<PduEvent>
Source§impl Service
impl Service
Sourcepub async fn prev_shortstatehash(
&self,
room_id: &RoomId,
before: PduCount,
) -> Result<ShortStateHash>
pub async fn prev_shortstatehash( &self, room_id: &RoomId, before: PduCount, ) -> Result<ShortStateHash>
Returns the shortstatehash of the room at the event directly preceding the
exclusive before param. before does not have to be a valid count
or in the room.
Source§impl Service
impl Service
Sourcepub async fn next_shortstatehash(
&self,
room_id: &RoomId,
after: PduCount,
) -> Result<ShortStateHash>
pub async fn next_shortstatehash( &self, room_id: &RoomId, after: PduCount, ) -> Result<ShortStateHash>
Returns the shortstatehash of the room at the event directly following the
exclusive after param. after does not have to be a valid count or
in the room.
Source§impl Service
impl Service
Sourcepub async fn get_shortstatehash(
&self,
room_id: &RoomId,
count: PduCount,
) -> Result<ShortStateHash>
pub async fn get_shortstatehash( &self, room_id: &RoomId, count: PduCount, ) -> Result<ShortStateHash>
Returns the shortstatehash of the room at the event
Source§impl Service
impl Service
Sourcepub async fn prev_timeline_count(&self, before: &PduId) -> Result<PduCount>
pub async fn prev_timeline_count(&self, before: &PduId) -> Result<PduCount>
Returns the shorteventid in the room preceding the exclusive before param.
before does not have to be a valid shorteventid or in the room.
Source§impl Service
impl Service
Sourcepub async fn next_timeline_count(&self, after: &PduId) -> Result<PduCount>
pub async fn next_timeline_count(&self, after: &PduId) -> Result<PduCount>
Returns the next shorteventid in the room after the exclusive after param.
after does not have to be a valid shorteventid or in the room.
Source§impl Service
impl Service
pub async fn get_event_id_near_ts( &self, room_id: &RoomId, ts: MilliSecondsSinceUnixEpoch, dir: Direction, ) -> Result<(MilliSecondsSinceUnixEpoch, OwnedEventId)>
Source§impl Service
impl Service
pub async fn get_pdu_id_near_ts( &self, room_id: &RoomId, ts: MilliSecondsSinceUnixEpoch, dir: Direction, ) -> Result<(MilliSecondsSinceUnixEpoch, PduId)>
Source§impl Service
impl Service
pub async fn get_pdu_near_ts( &self, _user_id: Option<&UserId>, room_id: &RoomId, ts: MilliSecondsSinceUnixEpoch, dir: Direction, ) -> Result<PdusIterItem>
Source§impl Service
impl Service
async fn count_to_id( &self, room_id: &RoomId, count: PduCount, dir: Direction, ) -> Result<RawPduId>
Source§impl Service
impl Service
fn pdu_count_to_id( shortroomid: ShortRoomId, count: PduCount, dir: Direction, ) -> RawPduId
Source§impl Service
impl Service
Sourcepub async fn get_pdu_from_shorteventid(
&self,
shorteventid: ShortEventId,
) -> Result<PduEvent>
pub async fn get_pdu_from_shorteventid( &self, shorteventid: ShortEventId, ) -> Result<PduEvent>
Returns the pdu from shorteventid
Checks the eventid_outlierpdu Tree if not found in the timeline.
Source§impl Service
impl Service
Sourcepub async fn get_outlier_pdu(&self, event_id: &EventId) -> Result<PduEvent>
pub async fn get_outlier_pdu(&self, event_id: &EventId) -> Result<PduEvent>
Returns the pdu.
Checks the eventid_outlierpdu Tree if not found in the timeline.
Source§impl Service
impl Service
Sourcepub async fn get_non_outlier_pdu(&self, event_id: &EventId) -> Result<PduEvent>
pub async fn get_non_outlier_pdu(&self, event_id: &EventId) -> Result<PduEvent>
Returns the pdu.
Checks the eventid_outlierpdu Tree if not found in the timeline.
Source§impl Service
impl Service
Sourcepub async fn get_pdu_from_id(&self, pdu_id: &RawPduId) -> Result<PduEvent>
pub async fn get_pdu_from_id(&self, pdu_id: &RawPduId) -> Result<PduEvent>
Returns the pdu.
This does NOT check the outliers Tree.
Source§impl Service
impl Service
Sourcepub async fn get_pdu_json(
&self,
event_id: &EventId,
) -> Result<CanonicalJsonObject>
pub async fn get_pdu_json( &self, event_id: &EventId, ) -> Result<CanonicalJsonObject>
Returns the json of a pdu.
Checks the eventid_outlierpdu Tree if not found in the timeline.
Source§impl Service
impl Service
Sourcepub async fn get_outlier_pdu_json(
&self,
event_id: &EventId,
) -> Result<CanonicalJsonObject>
pub async fn get_outlier_pdu_json( &self, event_id: &EventId, ) -> Result<CanonicalJsonObject>
Returns the json of a pdu.
Checks the eventid_outlierpdu Tree if not found in the timeline.
Source§impl Service
impl Service
Sourcepub async fn get_non_outlier_pdu_json(
&self,
event_id: &EventId,
) -> Result<CanonicalJsonObject>
pub async fn get_non_outlier_pdu_json( &self, event_id: &EventId, ) -> Result<CanonicalJsonObject>
Returns the json of a pdu.
Checks the eventid_outlierpdu Tree if not found in the timeline.
Source§impl Service
impl Service
Sourcepub async fn get_pdu_json_from_id(
&self,
pdu_id: &RawPduId,
) -> Result<CanonicalJsonObject>
pub async fn get_pdu_json_from_id( &self, pdu_id: &RawPduId, ) -> Result<CanonicalJsonObject>
Returns the pdu as a BTreeMap<String, CanonicalJsonValue>.
This does NOT check the outliers Tree.
Source§impl Service
impl Service
Sourcepub async fn get<T>(&self, event_id: &EventId) -> Result<T>where
T: for<'de> Deserialize<'de>,
pub async fn get<T>(&self, event_id: &EventId) -> Result<T>where
T: for<'de> Deserialize<'de>,
Returns the pdu into T.
Checks the eventid_outlierpdu Tree if not found in the timeline.
Source§impl Service
impl Service
Sourcepub async fn get_outlier<T>(&self, event_id: &EventId) -> Result<T>where
T: for<'de> Deserialize<'de>,
pub async fn get_outlier<T>(&self, event_id: &EventId) -> Result<T>where
T: for<'de> Deserialize<'de>,
Returns the pdu into T.
Checks the eventid_outlierpdu Tree if not found in the timeline.
Source§impl Service
impl Service
Sourcepub async fn get_non_outlier<T>(&self, event_id: &EventId) -> Result<T>where
T: for<'de> Deserialize<'de>,
pub async fn get_non_outlier<T>(&self, event_id: &EventId) -> Result<T>where
T: for<'de> Deserialize<'de>,
Returns the pdu into T.
Checks the eventid_outlierpdu Tree if not found in the timeline.
Source§impl Service
impl Service
Sourcepub async fn get_from_id<T>(&self, pdu_id: &RawPduId) -> Result<T>where
T: for<'de> Deserialize<'de>,
pub async fn get_from_id<T>(&self, pdu_id: &RawPduId) -> Result<T>where
T: for<'de> Deserialize<'de>,
Returns the pdu into T.
This does NOT check the outliers Tree.
Source§impl Service
impl Service
Sourcepub async fn pdu_exists<'a>(&'a self, event_id: &'a EventId) -> bool
pub async fn pdu_exists<'a>(&'a self, event_id: &'a EventId) -> bool
Checks if pdu exists
Checks the eventid_outlierpdu Tree if not found in the timeline.
Source§impl Service
impl Service
Sourcepub async fn non_outlier_pdu_exists(&self, event_id: &EventId) -> Result
pub async fn non_outlier_pdu_exists(&self, event_id: &EventId) -> Result
Like get_non_outlier_pdu(), but without the expense of fetching and parsing the PduEvent
Source§impl Service
impl Service
Sourcepub async fn outlier_pdu_exists(&self, event_id: &EventId) -> Result
pub async fn outlier_pdu_exists(&self, event_id: &EventId) -> Result
Like get_non_outlier_pdu(), but without the expense of fetching and parsing the PduEvent
Source§impl Service
impl Service
Sourcepub async fn get_pdu_count(&self, event_id: &EventId) -> Result<PduCount>
pub async fn get_pdu_count(&self, event_id: &EventId) -> Result<PduCount>
Returns the count of this pdu’s id.
Source§impl Service
impl Service
Sourcepub async fn get_shorteventid_from_pdu_id(
&self,
pdu_id: &PduId,
) -> Result<ShortEventId>
pub async fn get_shorteventid_from_pdu_id( &self, pdu_id: &PduId, ) -> Result<ShortEventId>
Returns the shorteventid from the pdu_id
Source§impl Service
impl Service
Sourcepub async fn get_event_id_from_pdu_id(
&self,
pdu_id: &PduId,
) -> Result<OwnedEventId>
pub async fn get_event_id_from_pdu_id( &self, pdu_id: &PduId, ) -> Result<OwnedEventId>
Returns the event_id from the pdu_id
Source§impl Service
impl Service
Sourcepub async fn get_pdu_id_from_shorteventid(
&self,
shorteventid: ShortEventId,
) -> Result<RawPduId>
pub async fn get_pdu_id_from_shorteventid( &self, shorteventid: ShortEventId, ) -> Result<RawPduId>
Returns the pdu_id from the shorteventid
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 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