pub struct Opts {Show 20 fields
pub op: Op,
pub room_id: Option<OwnedRoomId>,
pub event_id: Option<OwnedEventId>,
pub ts: Option<MilliSecondsSinceUnixEpoch>,
pub dir: Option<Direction>,
pub earliest_events: EventWindow,
pub latest_events: EventWindow,
pub hint: Option<OwnedServerName>,
pub candidates: Candidates,
pub room_version: Option<RoomVersionId>,
pub attempt_limit: Option<NonZeroUsize>,
pub backfill_limit: Option<NonZeroUsize>,
pub fanout_growth: FanoutGrowth,
pub fanout_max_width: Option<NonZeroUsize>,
pub fanout_rounds: Option<NonZeroUsize>,
pub check_event_id: bool,
pub check_conforms: bool,
pub check_hashes: bool,
pub authoritative_redaction: bool,
pub check_signature: bool,
}Expand description
Caller contract. event_id is the sought datum for Op::Event /
Op::AuthEvent / Op::AuthChain / Op::StateIds and a reference
point for the others.
Fields§
§op: OpFederation endpoint this fetch targets.
room_id: Option<OwnedRoomId>Room the fetch is scoped to, or None for an unscoped id-addressed
fetch.
event_id: Option<OwnedEventId>Event to fetch (id-addressed ops) or anchor from (room-scoped ops).
ts: Option<MilliSecondsSinceUnixEpoch>Timestamp the Op::TimestampToEvent search starts from; None for
every other op.
dir: Option<Direction>Direction the Op::TimestampToEvent search runs; None for every
other op.
earliest_events: EventWindowBoundary events the requester already holds; an Op::MissingEvents
window stops its backward walk here. Empty for every other op.
latest_events: EventWindowFrontier events an Op::MissingEvents window fills the predecessors
of. Empty for every other op.
hint: Option<OwnedServerName>Server to try ahead of the ranked candidates.
candidates: CandidatesCaller-supplied candidate pool tried in place of the room-derived ranking; empty defers to the room-derived candidates.
room_version: Option<RoomVersionId>Room version governing id and signature checks; None assumes V11.
attempt_limit: Option<NonZeroUsize>Cap on candidate servers tried; None tries every candidate.
backfill_limit: Option<NonZeroUsize>Event count requested per Op::Backfill / Op::MissingEvents batch
response; defaults to 10.
fanout_growth: FanoutGrowthPer-round width curve for staged fan-out. Fixed(1) is sequential.
fanout_max_width: Option<NonZeroUsize>Per-round concurrency ceiling. None lets the curve run free, clamped
only by the candidate pool and attempt_limit; Some(n) caps each
round at n.
fanout_rounds: Option<NonZeroUsize>Cap on escalation rounds before giving up. None runs until exhaustion.
check_event_id: boolReject a response whose event does not hash to the requested id.
check_conforms: boolReject a response that is not well-formed JSON.
check_hashes: boolReject a response that fails content-hash verification.
Accepted but not yet consulted; redaction-aware hash verification is unimplemented.
check_signature: boolReject a response that fails signature verification.
Implementations§
Source§impl Opts
impl Opts
Sourcepub fn unscoped(op: Op) -> Self
pub fn unscoped(op: Op) -> Self
A fetch with no room scope, for id-addressed callers such as
get-remote-pdu; room-derived candidate ranking is skipped, leaving the
hint, the caller-supplied pool, and the event id’s origin.
Sourcefn with_room_id(op: Op, room_id: Option<OwnedRoomId>) -> Self
fn with_room_id(op: Op, room_id: Option<OwnedRoomId>) -> Self
All validation toggles default on; the caller relaxes them per request.
Sourcepub fn event_id(self, event_id: OwnedEventId) -> Self
pub fn event_id(self, event_id: OwnedEventId) -> Self
Set the target event; required for the id-addressed ops.
Sourcepub fn ts(self, ts: MilliSecondsSinceUnixEpoch) -> Self
pub fn ts(self, ts: MilliSecondsSinceUnixEpoch) -> Self
Set the timestamp the Op::TimestampToEvent search starts from.
Sourcepub fn dir(self, dir: Direction) -> Self
pub fn dir(self, dir: Direction) -> Self
Set the direction the Op::TimestampToEvent search runs.
Sourcepub fn earliest_events<I>(self, earliest_events: I) -> Selfwhere
I: IntoIterator<Item = OwnedEventId>,
pub fn earliest_events<I>(self, earliest_events: I) -> Selfwhere
I: IntoIterator<Item = OwnedEventId>,
Set the boundary the Op::MissingEvents backward walk stops at.
Sourcepub fn latest_events<I>(self, latest_events: I) -> Selfwhere
I: IntoIterator<Item = OwnedEventId>,
pub fn latest_events<I>(self, latest_events: I) -> Selfwhere
I: IntoIterator<Item = OwnedEventId>,
Set the frontier an Op::MissingEvents window fills behind.
Sourcepub fn hint(self, hint: OwnedServerName) -> Self
pub fn hint(self, hint: OwnedServerName) -> Self
Try the named server ahead of the ranked candidates.
Sourcepub fn candidates<I>(self, candidates: I) -> Selfwhere
I: IntoIterator<Item = OwnedServerName>,
pub fn candidates<I>(self, candidates: I) -> Selfwhere
I: IntoIterator<Item = OwnedServerName>,
Supply the candidate pool verbatim, bypassing the room-derived ranking.
Sourcepub fn room_version(self, room_version: RoomVersionId) -> Self
pub fn room_version(self, room_version: RoomVersionId) -> Self
Room version for Op::Event id and signature checks. None keeps the
V11 default, so callers on a non-V11 room must name it to avoid a
spurious rejection.
Sourcepub fn attempt_limit(self, attempt_limit: NonZeroUsize) -> Self
pub fn attempt_limit(self, attempt_limit: NonZeroUsize) -> Self
Cap the number of candidate servers tried.
Sourcepub fn backfill_limit(self, backfill_limit: NonZeroUsize) -> Self
pub fn backfill_limit(self, backfill_limit: NonZeroUsize) -> Self
Set the events requested per Op::Backfill / Op::MissingEvents
batch.
Sourcepub fn fanout(self, growth: FanoutGrowth) -> Self
pub fn fanout(self, growth: FanoutGrowth) -> Self
Set the per-round fan-out width schedule.
Sourcepub fn fanout_max_width(self, max_width: NonZeroUsize) -> Self
pub fn fanout_max_width(self, max_width: NonZeroUsize) -> Self
Cap the per-round fan-out concurrency.
Sourcepub fn fanout_rounds(self, rounds: NonZeroUsize) -> Self
pub fn fanout_rounds(self, rounds: NonZeroUsize) -> Self
Cap the number of escalation rounds.
Sourcepub fn fanout_for_op(self) -> Self
pub fn fanout_for_op(self) -> Self
Apply the op’s advised staged-fan-out ramp. Opts::new is otherwise
dark on every op, so a callsite opts in by chaining this; the generic
and single-shot-batch ops keep the sequential default.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Opts
impl RefUnwindSafe for Opts
impl Send for Opts
impl Sync for Opts
impl Unpin for Opts
impl UnsafeUnpin for Opts
impl UnwindSafe for Opts
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,
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 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 more