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
impl<T> RefUnwindSafe for Server<T> where
T: RefUnwindSafe,
impl<T> Send for Server<T> where
T: Send,
impl<T> Sync for Server<T> where
T: Sync,
impl<T> Unpin for Server<T> where
T: Unpin,
impl<T> UnwindSafe for Server<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more