pub struct BackendRouter { /* private fields */ }Expand description
Routes components to appropriate execution backends based on platform.
The router considers the BackendMode (Linux native, WSL-backed, or
Windows native) and selects the best ExecutorKind for each component.
§Examples
use rusty_stack::platform::BackendRouter;
use rusty_stack::core::types::{BackendMode, ExecutorKind};
let router = BackendRouter::new(BackendMode::LinuxNative);
assert_ne!(router.executor_for("rocm"), ExecutorKind::Unsupported);
let win_router = BackendRouter::new(BackendMode::WindowsNative);
assert_eq!(win_router.executor_for("rocm"), ExecutorKind::Unsupported);Implementations§
Source§impl BackendRouter
impl BackendRouter
Sourcepub fn new(mode: BackendMode) -> Self
pub fn new(mode: BackendMode) -> Self
Create a new router for the given backend mode.
Sourcepub fn set_override(&mut self, component_id: &str, kind: ExecutorKind)
pub fn set_override(&mut self, component_id: &str, kind: ExecutorKind)
Set an executor override for a specific component.
Sourcepub fn executor_for(&self, component_id: &str) -> ExecutorKind
pub fn executor_for(&self, component_id: &str) -> ExecutorKind
Get the appropriate executor kind for the given component.
Returns ExecutorKind::Unsupported for unknown components.
Sourcepub fn mode(&self) -> BackendMode
pub fn mode(&self) -> BackendMode
Get the current backend mode.
Sourcepub fn unsupported_message(&self, component_id: &str) -> String
pub fn unsupported_message(&self, component_id: &str) -> String
Get a human-readable message explaining why a component is unsupported.
Returns an empty string if the component is not unsupported.
Trait Implementations§
Source§impl Clone for BackendRouter
impl Clone for BackendRouter
Auto Trait Implementations§
impl Freeze for BackendRouter
impl RefUnwindSafe for BackendRouter
impl Send for BackendRouter
impl Sync for BackendRouter
impl Unpin for BackendRouter
impl UnsafeUnpin for BackendRouter
impl UnwindSafe for BackendRouter
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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