pub struct Server<T> {
    pub command: Option<fn(_: &mut Conn, _: &T, _: Vec<Vec<u8>>)>,
    pub opened: Option<fn(_: &mut Conn, _: &T)>,
    pub closed: Option<fn(_: &mut Conn, _: &T, _: Option<Error>)>,
    pub tick: Option<fn(_: &T) -> Option<Duration>>,
    /* private fields */
}

Fields

command: Option<fn(_: &mut Conn, _: &T, _: Vec<Vec<u8>>)>

Handle incoming RESP commands.

opened: Option<fn(_: &mut Conn, _: &T)>

Handle incoming connections.

closed: Option<fn(_: &mut Conn, _: &T, _: Option<Error>)>

Handle closed connections.

If the connection was closed due to an error then that error is provided.

tick: Option<fn(_: &T) -> Option<Duration>>

Handle ticks at intervals as defined by the returned Duration.

The next tick will happen following the elapsed returned Duration.

Returning None will shutdown the server.

Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.