pub struct Router { /* private fields */ }Expand description
Lazily loads Laya checkpoints and sends each request to the right one.
Implementations§
Source§impl Router
impl Router
Sourcepub fn load(&self, name: &str) -> Result<Arc<Agent>>
pub fn load(&self, name: &str) -> Result<Arc<Agent>>
Return the Agent for name, downloading and building it on first use.
Sourcepub fn preload(&self, names: Option<&[&str]>) -> Result<()>
pub fn preload(&self, names: Option<&[&str]>) -> Result<()>
Pre-build the given checkpoints (or all configured ones) so no request pays a load.
Raises max_loaded to fit both the requested and already-resident checkpoints.
Sourcepub fn loaded(&self) -> Vec<String>
pub fn loaded(&self) -> Vec<String>
The currently loaded checkpoints (least-recently-used first).
Sourcepub fn predict(
&self,
state: &State,
questions: &Questions,
hints: &RouteHints<'_>,
) -> Result<SystemOneResult>
pub fn predict( &self, state: &State, questions: &Questions, hints: &RouteHints<'_>, ) -> Result<SystemOneResult>
Route, then answer every question in one forward pass on the chosen checkpoint.
Source§impl Router
impl Router
pub fn new(opts: RouterOptions) -> Result<Router>
Sourcepub fn with_defaults() -> Result<Router>
pub fn with_defaults() -> Result<Router>
Convenience constructor with default options.
Sourcepub fn route(
&self,
state: &State,
questions: Option<&Questions>,
hints: &RouteHints<'_>,
) -> Result<RouteDecision>
pub fn route( &self, state: &State, questions: Option<&Questions>, hints: &RouteHints<'_>, ) -> Result<RouteDecision>
Decide which checkpoint to use, without loading or running anything.
Auto Trait Implementations§
impl !Freeze for Router
impl RefUnwindSafe for Router
impl Send for Router
impl Sync for Router
impl Unpin for Router
impl UnsafeUnpin for Router
impl UnwindSafe for Router
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
Converts
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> ⓘ
Converts
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