[][src]Struct daemon_engine::server::Server

pub struct Server<T: AsyncRead + AsyncWrite, C: Encoder + Decoder, I> { /* fields omitted */ }

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]

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]

Clone over generic connector

All instances of a given connector contain the same arc/mutex protected information

default fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl<T, C, I> Send for Server<T, C, I> where
    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

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Erased for T