#[non_exhaustive]pub struct Routes { /* private fields */ }Expand description
Per-capability provider routing table.
Maps each Capability to an ordered list of Providers to try. A
capability with no entry falls back to Yahoo, or to EDGAR then Yahoo for
Capability::FILINGS.
Each route may carry its own Fetch mode, so a quota-limited capability
can stay sequential while another races its providers. Routes without one
use the table default.
Implementations§
Source§impl Routes
impl Routes
Sourcepub fn new(fetch: Fetch) -> Self
pub fn new(fetch: Fetch) -> Self
An empty route table (every capability falls back to its default
candidate providers) using the given concurrency Fetch mode.
Sourcepub fn route(
self,
cap: Capability,
providers: impl IntoIterator<Item = Provider>,
) -> Self
pub fn route( self, cap: Capability, providers: impl IntoIterator<Item = Provider>, ) -> Self
Route one capability to an ordered list of providers.
Without this a hand-built table is empty and every capability falls back to its default, so a registered adapter would never be reached.
Sourcepub fn route_with(
self,
cap: Capability,
providers: impl IntoIterator<Item = Provider>,
fetch: Fetch,
) -> Self
pub fn route_with( self, cap: Capability, providers: impl IntoIterator<Item = Provider>, fetch: Fetch, ) -> Self
Route one capability, overriding the table’s Fetch mode for it.
Sourcepub fn fetch_mode(&self) -> Fetch
pub fn fetch_mode(&self) -> Fetch
The default concurrency mode for capabilities that do not override it.
Sourcepub fn fetch_mode_for(&self, cap: Capability) -> Fetch
pub fn fetch_mode_for(&self, cap: Capability) -> Fetch
The concurrency mode cap resolves to.
Sourcepub fn providers_for(&self, cap: Capability) -> Option<&[Provider]>
pub fn providers_for(&self, cap: Capability) -> Option<&[Provider]>
The providers routed to cap, or None when it falls back to the default.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Routes
impl RefUnwindSafe for Routes
impl Send for Routes
impl Sync for Routes
impl Unpin for Routes
impl UnsafeUnpin for Routes
impl UnwindSafe for Routes
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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