pub struct Module { /* private fields */ }Expand description
Flask’s Blueprint, Rust-grade. Built by route crates’ pub fn module().
Implementations§
Source§impl Module
impl Module
pub fn new(name: impl Into<String>) -> Self
Sourcepub fn route(self, path: &str, methods: MethodRouter) -> Self
pub fn route(self, path: &str, methods: MethodRouter) -> Self
Register a path relative to the module’s mount point.
Sourcepub fn mount(self, prefix: &str, child: Module) -> Self
pub fn mount(self, prefix: &str, child: Module) -> Self
Mount a child module (subroute) under a relative prefix. Nests arbitrarily.
Sourcepub fn provide<T: Send + Sync + 'static>(self, value: T) -> Self
pub fn provide<T: Send + Sync + 'static>(self, value: T) -> Self
Module-scoped singleton value; shadows any parent provider of the same type.
Sourcepub fn provide_dep<F, Args, T>(self, factory: F) -> Self
pub fn provide_dep<F, Args, T>(self, factory: F) -> Self
Module-scoped async factory (request scope); shadows parents likewise.
Sourcepub fn middleware<M: Middleware>(self, mw: M) -> Self
pub fn middleware<M: Middleware>(self, mw: M) -> Self
Module-scoped middleware; runs after the app’s and parents’ middleware.
Auto Trait Implementations§
impl !RefUnwindSafe for Module
impl !UnwindSafe for Module
impl Freeze for Module
impl Send for Module
impl Sync for Module
impl Unpin for Module
impl UnsafeUnpin for Module
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