pub struct QuicServiceLoop<S>{ /* private fields */ }Expand description
Service loop for hosting RequestService over QUIC transport.
This struct wraps a QuicRep socket and a RequestService implementation,
running the QUIC accept loop in a dedicated thread with its own tokio runtime.
§Threading Model
RequestService is #[async_trait(?Send)] - handlers are not Send. This requires:
- Single-threaded runtime (
new_current_thread) LocalSetfor non-Send futuresspawn_localinstead oftokio::spawn- Service wrapped in
Rc<S>(notArc<S>)
§Usage
ⓘ
use hyprstream_rpc::transport::zmtp_quic::{QuicRep, QuicServiceLoop};
use hyprstream_rpc::service::spawner::{Spawnable, DualSpawnable};
let (tls, cert_der) = server_tls_self_signed("hyprstream.local")?;
let quic_rep = QuicRep::bind(addr, tls)?;
let service = MyService::new();
let quic_loop = QuicServiceLoop::new(quic_rep, service, cert_der);
// Use with DualSpawnable to run alongside ZMQ:
let dual = DualSpawnable::new(zmq_loop, quic_loop);
Ok(Box::new(dual))Implementations§
Source§impl<S> QuicServiceLoop<S>
impl<S> QuicServiceLoop<S>
Sourcepub fn new(rep: QuicRep, service: S, cert_der: Vec<u8>) -> Result<Self>
pub fn new(rep: QuicRep, service: S, cert_der: Vec<u8>) -> Result<Self>
Create a new QUIC service loop.
Sourcepub fn local_addr(&self) -> SocketAddr
pub fn local_addr(&self) -> SocketAddr
Get the QUIC endpoint address.
Trait Implementations§
Source§impl<S> Spawnable for QuicServiceLoop<S>
impl<S> Spawnable for QuicServiceLoop<S>
Source§fn registrations(&self) -> Vec<(SocketKind, TransportConfig)>
fn registrations(&self) -> Vec<(SocketKind, TransportConfig)>
Endpoints to register with EndpointRegistry. Read more
Auto Trait Implementations§
impl<S> Freeze for QuicServiceLoop<S>where
S: Freeze,
impl<S> !RefUnwindSafe for QuicServiceLoop<S>
impl<S> Send for QuicServiceLoop<S>
impl<S> Sync for QuicServiceLoop<S>
impl<S> Unpin for QuicServiceLoop<S>where
S: Unpin,
impl<S> UnsafeUnpin for QuicServiceLoop<S>where
S: UnsafeUnpin,
impl<S> !UnwindSafe for QuicServiceLoop<S>
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Apply a transformation to the response body. Read more
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using HTTP status codes. Read more
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using gRPC headers. Read more