Trait Client

Source
pub trait Client:
    Send
    + Sync
    + Sized {
    // Required methods
    fn open(url: &str) -> Option<Self>;
    fn close(self) -> Self;
    fn id(&self) -> ClientId;
    fn state(&self) -> ClientState;
    fn send(&mut self, id: MessageId, data: &[u8]) -> Option<Range<usize>>;
    fn read(&mut self) -> Option<(MessageId, Vec<u8>)>;

    // Provided methods
    fn read_all(&mut self) -> Vec<(MessageId, Vec<u8>)> { ... }
    fn process(&mut self) { ... }
}

Required Methods§

Source

fn open(url: &str) -> Option<Self>

Source

fn close(self) -> Self

Source

fn id(&self) -> ClientId

Source

fn state(&self) -> ClientState

Source

fn send(&mut self, id: MessageId, data: &[u8]) -> Option<Range<usize>>

Source

fn read(&mut self) -> Option<(MessageId, Vec<u8>)>

Provided Methods§

Source

fn read_all(&mut self) -> Vec<(MessageId, Vec<u8>)>

Source

fn process(&mut self)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Client for ()

Source§

fn open(_: &str) -> Option<Self>

Source§

fn close(self) -> Self

Source§

fn id(&self) -> ClientId

Source§

fn state(&self) -> ClientState

Source§

fn send(&mut self, _: MessageId, _: &[u8]) -> Option<Range<usize>>

Source§

fn read(&mut self) -> Option<(MessageId, Vec<u8>)>

Source§

fn read_all(&mut self) -> Vec<(MessageId, Vec<u8>)>

Implementors§