pub struct LayeredServer<S> {
pub service: S,
/* private fields */
}Expand description
A server with Tower middleware layers applied.
Created by Server::layer. Supports further .layer() calls and .serve().
Fields§
§service: SThe layered service. Exposed for advanced use cases (e.g., manual serving).
Implementations§
Source§impl<S> LayeredServer<S>
impl<S> LayeredServer<S>
Sourcepub fn with_state<T: Clone + Send + Sync + 'static>(self, state: T) -> Self
pub fn with_state<T: Clone + Send + Sync + 'static>(self, state: T) -> Self
Add shared state accessible via State<T> extractors.
Sourcepub fn max_body_size(self, max: usize) -> Self
pub fn max_body_size(self, max: usize) -> Self
Set the maximum request body size.
Sourcepub fn with_static_files(self, prefix: &str, dir: impl Into<PathBuf>) -> Self
pub fn with_static_files(self, prefix: &str, dir: impl Into<PathBuf>) -> Self
Serve static files from a directory.
Sourcepub fn with_spa_fallback(self, index_path: impl Into<PathBuf>) -> Self
pub fn with_spa_fallback(self, index_path: impl Into<PathBuf>) -> Self
Serve a file as SPA fallback for unmatched routes.
Auto Trait Implementations§
impl<S> Freeze for LayeredServer<S>where
S: Freeze,
impl<S> !RefUnwindSafe for LayeredServer<S>
impl<S> Send for LayeredServer<S>where
S: Send,
impl<S> Sync for LayeredServer<S>where
S: Sync,
impl<S> Unpin for LayeredServer<S>where
S: Unpin,
impl<S> UnsafeUnpin for LayeredServer<S>where
S: UnsafeUnpin,
impl<S> !UnwindSafe for LayeredServer<S>
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