pub struct MistralRsServerRouterBuilder { /* private fields */ }
Expand description
A builder for creating a mistral.rs server router with configurable options.
§Examples
Basic usage:
ⓘ
use mistralrs_server_core::mistralrs_server_router_builder::MistralRsServerRouterBuilder;
let router = MistralRsServerRouterBuilder::new()
.with_mistralrs(mistralrs_instance)
.build()
.await?;
With custom configuration:
ⓘ
use mistralrs_server_core::mistralrs_server_router_builder::MistralRsServerRouterBuilder;
let router = MistralRsServerRouterBuilder::new()
.with_mistralrs(mistralrs_instance)
.with_include_swagger_routes(false)
.with_base_path("/api/mistral")
.build()
.await?;
Implementations§
Source§impl MistralRsServerRouterBuilder
impl MistralRsServerRouterBuilder
Sourcepub fn with_mistralrs(self, mistralrs: SharedMistralRsState) -> Self
pub fn with_mistralrs(self, mistralrs: SharedMistralRsState) -> Self
Sets the shared mistral.rs instance
Sourcepub fn with_include_swagger_routes(self, include_swagger_routes: bool) -> Self
pub fn with_include_swagger_routes(self, include_swagger_routes: bool) -> Self
Configures whether to include OpenAPI doc routes.
When enabled (default), the router will include routes for Swagger UI
at /docs
and the OpenAPI specification at /api-doc/openapi.json
.
These routes respect the configured base path if one is set.
Sourcepub fn with_base_path(self, base_path: &str) -> Self
pub fn with_base_path(self, base_path: &str) -> Self
Sets a base path prefix for all routes.
When set, all routes will be prefixed with the given path. This is useful when including the mistral.rs server instance in another axum project.
Sourcepub fn with_allowed_origins(self, origins: Vec<String>) -> Self
pub fn with_allowed_origins(self, origins: Vec<String>) -> Self
Sets the CORS allowed origins.
Sourcepub fn with_max_body_limit(self, max_body_limit: usize) -> Self
pub fn with_max_body_limit(self, max_body_limit: usize) -> Self
Sets the axum default request body limit.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MistralRsServerRouterBuilder
impl !RefUnwindSafe for MistralRsServerRouterBuilder
impl Send for MistralRsServerRouterBuilder
impl Sync for MistralRsServerRouterBuilder
impl Unpin for MistralRsServerRouterBuilder
impl !UnwindSafe for MistralRsServerRouterBuilder
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<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Forward to the method defined on the type
Any
.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Forward to the method defined on the type
Any
.§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> ⓘ
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian()
.