[−][src]Struct daemon_engine::server::Server
Server provides a generic base for building stream servers.
This is generic over T, a stream reader and writer, C, and encoder and decoder, and I, and information object.
You probably want to be looking at TcpServer and UnixServer implementations
Methods
impl<T, C, I> Server<T, C, I> where
T: AsyncWrite + AsyncRead + Send + Sync + 'static,
C: Encoder + Decoder + Clone + Send + 'static,
I: Clone + Send + Debug + 'static,
<C as Decoder>::Item: Clone + Send + Debug,
<C as Decoder>::Error: Send + Debug,
<C as Encoder>::Item: Clone + Send + Debug,
<C as Encoder>::Error: Send + Debug,
[src]
T: AsyncWrite + AsyncRead + Send + Sync + 'static,
C: Encoder + Decoder + Clone + Send + 'static,
I: Clone + Send + Debug + 'static,
<C as Decoder>::Item: Clone + Send + Debug,
<C as Decoder>::Error: Send + Debug,
<C as Encoder>::Item: Clone + Send + Debug,
<C as Encoder>::Error: Send + Debug,
pub fn base(codec: C) -> Server<T, C, I>
[src]
Create a new base server with defined request and response message types.
This sets up internal resources however requires implementation to handle creating listeners and binding connections See TcpServer and UnixServer for examples
pub fn incoming(&mut self) -> Option<UnboundedReceiver<Request<T, C, I>>>
[src]
Take the incoming data handle.
You can then use for_each
to iterate over received requests as in
the examples
pub fn bind(&mut self, info: I, socket: T)
[src]
Bind a socket to a server.
This attaches an rx handler to the server, and can be used both for server listener implementations as well as to support server-initialised connections if required
pub fn close(self)
[src]
Close the socket server
This sends exit messages to the main task and all connected hosts
Trait Implementations
impl<T, C, I> Clone for Server<T, C, I> where
T: AsyncWrite + AsyncRead + Send + Sync + 'static,
C: Encoder + Decoder + Clone + Send + 'static,
I: Clone + Send + Debug + 'static,
<C as Decoder>::Item: Clone + Send + Debug,
<C as Decoder>::Error: Send + Debug,
<C as Encoder>::Item: Clone + Send + Debug,
<C as Encoder>::Error: Send + Debug,
[src]
T: AsyncWrite + AsyncRead + Send + Sync + 'static,
C: Encoder + Decoder + Clone + Send + 'static,
I: Clone + Send + Debug + 'static,
<C as Decoder>::Item: Clone + Send + Debug,
<C as Decoder>::Error: Send + Debug,
<C as Encoder>::Item: Clone + Send + Debug,
<C as Encoder>::Error: Send + Debug,
Clone over generic connector
All instances of a given connector contain the same arc/mutex protected information
Auto Trait Implementations
impl<T, C, I> Send for Server<T, C, I> where
C: Send,
I: Send,
<C as Decoder>::Item: Send,
C: Send,
I: Send,
<C as Decoder>::Item: Send,
impl<T, C, I> Sync for Server<T, C, I> where
C: Sync,
I: Send + Sync,
<C as Decoder>::Item: Send,
C: Sync,
I: Send + Sync,
<C as Decoder>::Item: Send,
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.