pub struct RpcServer<S, C = BoxedListener<S>> { /* private fields */ }
Expand description
A server for a specific service.
This is a wrapper around a Listener
that serves as the entry point for the server DSL.
Type parameters:
S
is the service type.
C
is the channel type.
Implementations§
Source§impl<S: Service, C: Listener<S>> RpcServer<S, C>
impl<S: Service, C: Listener<S>> RpcServer<S, C>
Source§impl<S: Service, C: Listener<S>> RpcServer<S, C>
impl<S: Service, C: Listener<S>> RpcServer<S, C>
Sourcepub async fn accept(&self) -> Result<Accepting<S, C>, RpcServerError<C>>
pub async fn accept(&self) -> Result<Accepting<S, C>, RpcServerError<C>>
Accepts a new channel from a client. The result is an Accepting object that can be used to read the first request.
Sourcepub fn into_inner(self) -> C
pub fn into_inner(self) -> C
Get the underlying service endpoint
Sourcepub async fn accept_loop<Fun, Fut, E>(self, handler: Fun)
pub async fn accept_loop<Fun, Fut, E>(self, handler: Fun)
Run an accept loop for this server.
Each request will be handled in a separate task.
It is the caller’s responsibility to poll the returned future to drive the server.
Sourcepub fn spawn_accept_loop<Fun, Fut, E>(
self,
handler: Fun,
) -> AbortOnDropHandle<()>
pub fn spawn_accept_loop<Fun, Fut, E>( self, handler: Fun, ) -> AbortOnDropHandle<()>
Spawn an accept loop and return a handle to the task.
Trait Implementations§
Auto Trait Implementations§
impl<S, C> Freeze for RpcServer<S, C>where
C: Freeze,
impl<S, C> RefUnwindSafe for RpcServer<S, C>where
C: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, C> Send for RpcServer<S, C>
impl<S, C> Sync for RpcServer<S, C>
impl<S, C> Unpin for RpcServer<S, C>
impl<S, C> UnwindSafe for RpcServer<S, C>where
C: UnwindSafe,
S: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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