pub struct HttpServer { /* private fields */ }
Expand description
Implementations§
Source§impl HttpServer
impl HttpServer
pub fn create_server(host: &str, port: u16) -> Self
Sourcepub fn listen(self)
pub fn listen(self)
start listen request
§Example
let mut server = HttpServer::create_server("localhost", 3000);
server.listen();
Sourcepub fn map(&mut self, url: &str, path: &str)
pub fn map(&mut self, url: &str, path: &str)
url prefix
absolute path
say
map("/path","/file")
the url /path/a would be mapped to /file/a which is a fs path
pub fn filter( &mut self, url: &str, filter: impl Fn(HttpRequest, HttpResponse) -> Option<(HttpRequest, HttpResponse)> + Send + Sync + 'static, )
Trait Implementations§
Source§impl HttpHander for HttpServer
impl HttpHander for HttpServer
Auto Trait Implementations§
impl Freeze for HttpServer
impl !RefUnwindSafe for HttpServer
impl Send for HttpServer
impl Sync for HttpServer
impl Unpin for HttpServer
impl !UnwindSafe for HttpServer
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