pub struct Server<P: Protocol> { /* private fields */ }Expand description
A server endpoint for one connection.
Consume it with serve to dispatch requests from the peer.
Implementations§
Source§impl<P: Protocol> Server<P>
impl<P: Protocol> Server<P>
Sourcepub async fn serve<H>(self, handler: H) -> Result<(), Error>
pub async fn serve<H>(self, handler: H) -> Result<(), Error>
Serves requests until the peer disconnects, the session fails, or a handler requests graceful shutdown.
The handler may be called concurrently for independent requests. Each
invocation must consume its CallContext with CallContext::respond
or CallContext::respond_with_trailer; dropping the context without
responding reports a per-request error to the peer.
Auto Trait Implementations§
impl<P> !RefUnwindSafe for Server<P>
impl<P> !Sync for Server<P>
impl<P> !UnwindSafe for Server<P>
impl<P> Freeze for Server<P>
impl<P> Send for Server<P>
impl<P> Unpin for Server<P>
impl<P> UnsafeUnpin for Server<P>where
UnboundedSender<Outgoing<<P as Protocol>::Response>>: UnsafeUnpin,
UnboundedReceiver<Outgoing<<P as Protocol>::Response>>: UnsafeUnpin,
PhantomData<fn() -> P>: UnsafeUnpin,
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