pub struct QuicServer { /* private fields */ }Expand description
A QUIC server that delegates incoming gRPC requests to a tonic service.
QuicServer
└── quinn::Endpoint (accepts QUIC connections)
└── per connection: accept bi-streams
└── each bi-stream: read path + gRPC bytes → tonic handlerⓘ
// Build and start the server:
let server = QuicServer::builder()
.tls(tls_config)
.build();
// Pass any tonic-generated Router or service_fn:
server.serve(addr, MyServiceServer::new(my_service)).await?;Implementations§
Source§impl QuicServer
impl QuicServer
Sourcepub fn builder() -> QuicServerBuilder
pub fn builder() -> QuicServerBuilder
Return a builder to configure the server.
Sourcepub async fn serve<S>(
self,
addr: SocketAddr,
service: S,
) -> Result<(), ServerError>
pub async fn serve<S>( self, addr: SocketAddr, service: S, ) -> Result<(), ServerError>
Bind to addr and serve requests until a shutdown signal is received.
Sourcepub async fn serve_with_shutdown<S, F>(
self,
addr: SocketAddr,
service: S,
signal: F,
) -> Result<(), ServerError>
pub async fn serve_with_shutdown<S, F>( self, addr: SocketAddr, service: S, signal: F, ) -> Result<(), ServerError>
Bind to addr and serve requests until the signal future completes.
Sourcepub async fn serve_with_incoming<S>(
self,
endpoint: QuicEndpoint,
service: S,
) -> Result<(), ServerError>
pub async fn serve_with_incoming<S>( self, endpoint: QuicEndpoint, service: S, ) -> Result<(), ServerError>
Serve requests over an already-bound QuicEndpoint.
Sourcepub async fn serve_with_incoming_shutdown<S, F>(
self,
endpoint: QuicEndpoint,
service: S,
signal: F,
) -> Result<(), ServerError>
pub async fn serve_with_incoming_shutdown<S, F>( self, endpoint: QuicEndpoint, service: S, signal: F, ) -> Result<(), ServerError>
Serve requests over an already-bound QuicEndpoint until the signal future completes.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for QuicServer
impl !UnwindSafe for QuicServer
impl Freeze for QuicServer
impl Send for QuicServer
impl Sync for QuicServer
impl Unpin for QuicServer
impl UnsafeUnpin for QuicServer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request