pub struct ProtosocketServer<Connector: ServerConnector> { /* private fields */ }Expand description
A protosocket::Connection is an IO driver. It directly uses tokio’s io wrapper of mio to poll
the OS’s io primitives, manages read and write buffers, and vends messages to & from connections.
Connections send messages to the ConnectionServer through an mpsc channel, and they receive
inbound messages via a reactor callback.
Protosockets are 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. Of course you can do whatever you want, as the telnet example shows.
Protosocket messages are not opinionated about request & reply. If you are, you will need
to implement such a thing. This allows you freely choose whether you want to send
fire-&-forget messages sometimes; however it requires you to write your protocol’s rules.
You get an inbound iterable of
A ProtosocketServer is a future: You spawn it and it runs forever.
Construct a new ProtosocketServer by creating a ProtosocketServerConfig and calling the {{bind_tcp}} method.
Trait Implementations§
Source§impl<Connector: ServerConnector> Future for ProtosocketServer<Connector>
impl<Connector: ServerConnector> Future for ProtosocketServer<Connector>
impl<Connector: ServerConnector> Unpin for ProtosocketServer<Connector>
Auto Trait Implementations§
impl<Connector> Freeze for ProtosocketServer<Connector>
impl<Connector> RefUnwindSafe for ProtosocketServer<Connector>
impl<Connector> Send for ProtosocketServer<Connector>
impl<Connector> Sync for ProtosocketServer<Connector>
impl<Connector> UnwindSafe for ProtosocketServer<Connector>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§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>.