pub struct App {
pub address: String,
pub port: u32,
pub armor: Option<Arc<Box<dyn SapperArmor + Send + Sync + 'static>>>,
pub routers: Router,
pub static_file_service: bool,
pub init_closure: Option<Arc<Box<dyn Fn(&mut SapperRequest<'_, '_>) -> Result<()> + Send + Sync + 'static>>>,
pub not_found: Option<String>,
}
Expand description
Sapper app struct
Fields§
§address: String
§port: u32
§armor: Option<Arc<Box<dyn SapperArmor + Send + Sync + 'static>>>
§routers: Router
§static_file_service: bool
§init_closure: Option<Arc<Box<dyn Fn(&mut SapperRequest<'_, '_>) -> Result<()> + Send + Sync + 'static>>>
§not_found: Option<String>
Implementations§
Source§impl SapperApp
impl SapperApp
pub fn new() -> SapperApp
pub fn address(&mut self, address: &str) -> &mut Self
pub fn port(&mut self, port: u32) -> &mut Self
pub fn static_file_service(&mut self, open: bool) -> &mut Self
pub fn with_armor( &mut self, w: Box<dyn SapperArmor + Send + Sync + 'static>, ) -> &mut Self
pub fn init_global( &mut self, clos: Box<dyn Fn(&mut SapperRequest<'_, '_>) -> Result<()> + Send + Sync + 'static>, ) -> &mut Self
pub fn not_found_page(&mut self, page: String) -> &mut Self
pub fn add_module(&mut self, sm: Box<dyn SapperModule>) -> &mut Self
pub fn run_http(self)
Trait Implementations§
Source§impl Handler for SapperApp
impl Handler for SapperApp
Source§fn check_continue(&self, _: (&Method, &RequestUri, &Headers)) -> StatusCode
fn check_continue(&self, _: (&Method, &RequestUri, &Headers)) -> StatusCode
Called when a Request includes a
Expect: 100-continue
header. Read moreSource§fn on_connection_start(&self)
fn on_connection_start(&self)
This is run after a connection is received, on a per-connection basis (not a
per-request basis, as a connection with keep-alive may handle multiple
requests)
Source§fn on_connection_end(&self)
fn on_connection_end(&self)
This is run before a connection is closed, on a per-connection basis (not a
per-request basis, as a connection with keep-alive may handle multiple
requests)
Auto Trait Implementations§
impl Freeze for SapperApp
impl !RefUnwindSafe for SapperApp
impl Send for SapperApp
impl Sync for SapperApp
impl Unpin for SapperApp
impl !UnwindSafe for SapperApp
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