pub struct ServiceServer<T> { /* private fields */ }Expand description
Monomorphic dispatcher for Service.
Unlike .register(Router) which type-erases each method into an Arc<dyn ErasedHandler> stored in a HashMap, this struct dispatches via a compile-time match on method name: no vtable, no hash lookup.
§Example
ⓘ
use connectrpc::ConnectRpcService;
let server = ServiceServer::new(MyImpl);
let service = ConnectRpcService::new(server);
// hand `service` to axum/hyper as a fallback_serviceImplementations§
Trait Implementations§
Source§impl<T> Clone for ServiceServer<T>
impl<T> Clone for ServiceServer<T>
Source§impl<T: Service> Dispatcher for ServiceServer<T>
impl<T: Service> Dispatcher for ServiceServer<T>
Source§fn lookup(&self, path: &str) -> Option<MethodDescriptor>
fn lookup(&self, path: &str) -> Option<MethodDescriptor>
Look up a method by its
service_name/method_name path. Read moreSource§fn call_unary(
&self,
path: &str,
ctx: RequestContext,
request: Payload,
format: CodecFormat,
) -> UnaryResult
fn call_unary( &self, path: &str, ctx: RequestContext, request: Payload, format: CodecFormat, ) -> UnaryResult
Dispatch a unary call. Read more
Source§fn call_server_streaming(
&self,
path: &str,
ctx: RequestContext,
request: Bytes,
format: CodecFormat,
) -> StreamingResult
fn call_server_streaming( &self, path: &str, ctx: RequestContext, request: Bytes, format: CodecFormat, ) -> StreamingResult
Dispatch a server-streaming call. Read more
Source§fn call_client_streaming(
&self,
path: &str,
ctx: RequestContext,
requests: RequestStream,
format: CodecFormat,
) -> UnaryResult
fn call_client_streaming( &self, path: &str, ctx: RequestContext, requests: RequestStream, format: CodecFormat, ) -> UnaryResult
Dispatch a client-streaming call. Read more
Source§fn call_bidi_streaming(
&self,
path: &str,
ctx: RequestContext,
requests: RequestStream,
format: CodecFormat,
) -> StreamingResult
fn call_bidi_streaming( &self, path: &str, ctx: RequestContext, requests: RequestStream, format: CodecFormat, ) -> StreamingResult
Dispatch a bidi-streaming call. Read more
Auto Trait Implementations§
impl<T> Freeze for ServiceServer<T>
impl<T> RefUnwindSafe for ServiceServer<T>where
T: RefUnwindSafe,
impl<T> Send for ServiceServer<T>
impl<T> Sync for ServiceServer<T>
impl<T> Unpin for ServiceServer<T>
impl<T> UnsafeUnpin for ServiceServer<T>
impl<T> UnwindSafe for ServiceServer<T>where
T: RefUnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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