pub struct ServerFuture(/* private fields */);Expand description
Opaque future returned by Server::serve, Server::serve_with_graceful_shutdown,
and Server::serve_from_listener.
A ServerFuture can be used in two ways:
.await— drives the server inline in the current task..background()— spawns the server on a new Tokio task and returns atokio::task::JoinHandle<()>immediately.
Implementations§
Source§impl ServerFuture
impl ServerFuture
Sourcepub fn background(self) -> JoinHandle<()>
pub fn background(self) -> JoinHandle<()>
Spawns the server on a new Tokio background task and returns a JoinHandle<()>.
§Panics
Panics if called outside a Tokio runtime.
Trait Implementations§
Source§impl IntoFuture for ServerFuture
impl IntoFuture for ServerFuture
Auto Trait Implementations§
impl Freeze for ServerFuture
impl !RefUnwindSafe for ServerFuture
impl Send for ServerFuture
impl !Sync for ServerFuture
impl Unpin for ServerFuture
impl UnsafeUnpin for ServerFuture
impl !UnwindSafe for ServerFuture
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