pub struct ServerState { /* private fields */ }Expand description
Server state with immutable default provider and lazy runner cache
Unlike the MCP server, there is no mutable active provider or model. All provider routing is determined per-request via the model string. The runner cache avoids recreating providers on every request.
Implementations§
Source§impl ServerState
impl ServerState
Sourcepub fn new(default_provider: CliRunnerType) -> Self
pub fn new(default_provider: CliRunnerType) -> Self
Create server state with the given default provider
Sourcepub const fn default_provider(&self) -> CliRunnerType
pub const fn default_provider(&self) -> CliRunnerType
Get the server’s default provider type
Sourcepub async fn get_runner(
&self,
provider: CliRunnerType,
) -> Result<Arc<dyn LlmProvider>, RunnerError>
pub async fn get_runner( &self, provider: CliRunnerType, ) -> Result<Arc<dyn LlmProvider>, RunnerError>
Get or lazily create a runner for the given provider type
Created runners are cached for future calls. The lock is released during runner creation to avoid blocking concurrent requests.
Auto Trait Implementations§
impl !Freeze for ServerState
impl !RefUnwindSafe for ServerState
impl Send for ServerState
impl Sync for ServerState
impl Unpin for ServerState
impl UnsafeUnpin for ServerState
impl !UnwindSafe for ServerState
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> 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