pub struct Server<Tx, Rx, Buf, D>{ /* private fields */ }
Expand description
The Server
is the main interface for handling communication
Implementations§
Source§impl<Tx, Rx, Buf, D> Server<Tx, Rx, Buf, D>
impl<Tx, Rx, Buf, D> Server<Tx, Rx, Buf, D>
Sourcepub fn new(tx: Tx, rx: Rx, buf: Buf, dis: D, kkind: VarKeyKind) -> Self
pub fn new(tx: Tx, rx: Rx, buf: Buf, dis: D, kkind: VarKeyKind) -> Self
Create a new Server
Takes:
- a
WireTx
impl for sending - a
WireRx
impl for receiving - a buffer used for receiving frames
- The user provided dispatching method, usually generated by
define_dispatch!()
- a
VarKeyKind
, which controls the key sizes sent by theWireTx
impl
Sourcepub async fn run(&mut self) -> ServerError<Tx, Rx>
pub async fn run(&mut self) -> ServerError<Tx, Rx>
Run until a fatal error occurs
The server will receive frames, and dispatch them. When a fatal error occurs, this method will return with the fatal error.
The caller may decide to wait until a connection is re-established, reset any state, or immediately begin re-running.
Auto Trait Implementations§
impl<Tx, Rx, Buf, D> Freeze for Server<Tx, Rx, Buf, D>
impl<Tx, Rx, Buf, D> RefUnwindSafe for Server<Tx, Rx, Buf, D>
impl<Tx, Rx, Buf, D> Send for Server<Tx, Rx, Buf, D>
impl<Tx, Rx, Buf, D> Sync for Server<Tx, Rx, Buf, D>
impl<Tx, Rx, Buf, D> Unpin for Server<Tx, Rx, Buf, D>
impl<Tx, Rx, Buf, D> UnwindSafe for Server<Tx, Rx, Buf, D>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more