pub struct SocketRpcServer<TSocketService>where
TSocketService: SocketService,{ /* private fields */ }
Expand description
A SocketRpcServer
is a server future. It listens on a socket and spawns new connections,
with a ConnectionService to handle each connection.
Protosockets use monomorphic messages: You can only have 1 kind of message per service. The expected way to work with this is to use prost and protocol buffers to encode messages.
The socket server hosts your SocketService. Your SocketService creates a ConnectionService for each new connection. Your ConnectionService manages one connection. It is Dropped when the connection is closed.
Implementations§
Source§impl<TSocketService> SocketRpcServer<TSocketService>where
TSocketService: SocketService,
impl<TSocketService> SocketRpcServer<TSocketService>where
TSocketService: SocketService,
Sourcepub async fn new(
address: SocketAddr,
socket_server: TSocketService,
) -> Result<Self>
pub async fn new( address: SocketAddr, socket_server: TSocketService, ) -> Result<Self>
Construct a new SocketRpcServer
listening on the provided address.
Sourcepub fn set_max_buffer_length(&mut self, max_buffer_length: usize)
pub fn set_max_buffer_length(&mut self, max_buffer_length: usize)
Set the maximum buffer length for connections created by this server after the setting is applied.
Sourcepub fn set_max_queued_outbound_messages(
&mut self,
max_queued_outbound_messages: usize,
)
pub fn set_max_queued_outbound_messages( &mut self, max_queued_outbound_messages: usize, )
Set the maximum queued outbound messages for connections created by this server after the setting is applied.
Trait Implementations§
Source§impl<TSocketService> Future for SocketRpcServer<TSocketService>where
TSocketService: SocketService,
impl<TSocketService> Future for SocketRpcServer<TSocketService>where
TSocketService: SocketService,
Auto Trait Implementations§
impl<TSocketService> !Freeze for SocketRpcServer<TSocketService>
impl<TSocketService> RefUnwindSafe for SocketRpcServer<TSocketService>where
TSocketService: RefUnwindSafe,
impl<TSocketService> Send for SocketRpcServer<TSocketService>where
TSocketService: Send,
impl<TSocketService> Sync for SocketRpcServer<TSocketService>where
TSocketService: Sync,
impl<TSocketService> Unpin for SocketRpcServer<TSocketService>where
TSocketService: Unpin,
impl<TSocketService> UnwindSafe for SocketRpcServer<TSocketService>where
TSocketService: UnwindSafe,
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn map<U, F>(self, f: F) -> Map<Self, F>
fn map<U, F>(self, f: F) -> Map<Self, F>
Source§fn map_into<U>(self) -> MapInto<Self, U>
fn map_into<U>(self) -> MapInto<Self, U>
Source§fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
f
. Read moreSource§fn left_future<B>(self) -> Either<Self, B>
fn left_future<B>(self) -> Either<Self, B>
Source§fn right_future<A>(self) -> Either<A, Self>
fn right_future<A>(self) -> Either<A, Self>
Source§fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
Source§fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Source§fn flatten_stream(self) -> FlattenStream<Self>
fn flatten_stream(self) -> FlattenStream<Self>
Source§fn fuse(self) -> Fuse<Self>where
Self: Sized,
fn fuse(self) -> Fuse<Self>where
Self: Sized,
poll
will never again be called once it has
completed. This method can be used to turn any Future
into a
FusedFuture
. Read moreSource§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
Source§fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
Source§fn remote_handle(self) -> (Remote<Self>, RemoteHandle<Self::Output>)where
Self: Sized,
fn remote_handle(self) -> (Remote<Self>, RemoteHandle<Self::Output>)where
Self: Sized,
()
on completion and sends
its output to another future on a separate task. Read moreSource§fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a>>
fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a>>
Source§fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>>where
Self: Sized + 'a,
fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>>where
Self: Sized + 'a,
Source§fn unit_error(self) -> UnitError<Self>where
Self: Sized,
fn unit_error(self) -> UnitError<Self>where
Self: Sized,
Future<Output = T>
into a
TryFuture<Ok = T, Error = ()
>.Source§fn never_error(self) -> NeverError<Self>where
Self: Sized,
fn never_error(self) -> NeverError<Self>where
Self: Sized,
Future<Output = T>
into a
TryFuture<Ok = T, Error = Never
>.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_cancellation_token(
self,
cancellation_token: &CancellationToken,
) -> WithCancellationTokenFuture<'_, Self>where
Self: Sized,
fn with_cancellation_token(
self,
cancellation_token: &CancellationToken,
) -> WithCancellationTokenFuture<'_, Self>where
Self: Sized,
CancellationToken::run_until_cancelled
,
but with the advantage that it is easier to write fluent call chains,
and biased towards waiting for CancellationToken
to complete. Read moreSource§fn with_cancellation_token_owned(
self,
cancellation_token: CancellationToken,
) -> WithCancellationTokenFutureOwned<Self>where
Self: Sized,
fn with_cancellation_token_owned(
self,
cancellation_token: CancellationToken,
) -> WithCancellationTokenFutureOwned<Self>where
Self: Sized,
CancellationToken::run_until_cancelled_owned
,
but with the advantage that it is easier to write fluent call chains,
and biased towards waiting for CancellationToken
to complete. Read more