pub struct Server { /* private fields */ }Expand description
A multi-threaded HTTP or HTTP/2 web server.
Implementations§
Source§impl Server
impl Server
Sourcepub fn with_pre_bound_listener(self, listener: TcpListener) -> Self
pub fn with_pre_bound_listener(self, listener: TcpListener) -> Self
Attach a pre-bound TCP listener. The server will use this listener
instead of creating one from the --host / --port settings.
The listener must already be in a listening state (created via
std::net::TcpListener::bind).
Sourcepub fn run_standalone(self, cancel: Option<Receiver<()>>) -> Result
pub fn run_standalone(self, cancel: Option<Receiver<()>>) -> Result
Run the multi-threaded Server as standalone.
It accepts an optional cancel parameter to shut down the server
gracefully on demand as a complement to the termination signals handling.
Sourcepub fn run_server_on_rt<F>(
self,
cancel_recv: Option<Receiver<()>>,
cancel_fn: F,
exit_on_error: bool,
) -> Resultwhere
F: FnOnce(),
pub fn run_server_on_rt<F>(
self,
cancel_recv: Option<Receiver<()>>,
cancel_fn: F,
exit_on_error: bool,
) -> Resultwhere
F: FnOnce(),
Build and run the multi-threaded Server on the Tokio runtime.
Setting exit_on_error to true will exit the entire process if
the server fails to start (previous behaviour).
Auto Trait Implementations§
impl Freeze for Server
impl RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl UnsafeUnpin for Server
impl UnwindSafe for Server
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