pub struct HttpModule;Expand description
The HTTP module: the server, default layer stack, JSON errors,
controllers. Global; provides and exports HttpOptions, HttpServer
and UrlSigner; registers the commands serve, routes, down and
up; and checks every route and every mount at boot (access
declarations, duplicate routes, a mount’s prefix and what it overlaps,
missing authenticator or authorizer), before serve binds a port.
use navree_http::{HttpModule, HttpOptions};
use navree_kernel::Navree;
Navree::app()
.module(HttpModule::for_root(HttpOptions::default()))
.run()Used plainly (.module(HttpModule)) or through
from_config, it reads the http
configuration section, so the app must include ConfigModule.
Implementations§
Source§impl HttpModule
impl HttpModule
Sourcepub fn for_root(options: HttpOptions) -> impl Module
pub fn for_root(options: HttpOptions) -> impl Module
The module with explicit options (configure it once, in the app root).
Sourcepub fn from_config() -> impl Module
pub fn from_config() -> impl Module
The module configured from the http section of Config at boot.
Trait Implementations§
Source§impl Clone for HttpModule
impl Clone for HttpModule
impl Copy for HttpModule
Source§impl Debug for HttpModule
impl Debug for HttpModule
Source§impl Default for HttpModule
impl Default for HttpModule
Source§impl Module for HttpModule
impl Module for HttpModule
Source§fn register(&self, m: &mut ModuleBuilder)
fn register(&self, m: &mut ModuleBuilder)
Registers everything the module contributes.
Source§fn id(&self) -> ModuleId
fn id(&self) -> ModuleId
The module identity.
for_root wrappers override this to return the id
of the module type they configure.Source§fn is_configured(&self) -> bool
fn is_configured(&self) -> bool
for_root(...) values return true; at most one configured instance per id.Auto Trait Implementations§
impl Forget for HttpModule
impl Freeze for HttpModule
impl Move for HttpModule
impl RefUnwindSafe for HttpModule
impl Send for HttpModule
impl Sync for HttpModule
impl Unpin for HttpModule
impl UnsafeUnpin for HttpModule
impl UnwindSafe for HttpModule
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