Trait async_proto::Protocol[][src]

pub trait Protocol: Sized {
    fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
        stream: &'a mut R
    ) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>;
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
        &'a self,
        sink: &'a mut W
    ) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>;
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>;
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>; fn read_ws<'a, R: Stream<Item = Result<Message, Error>> + Unpin + Send + 'a>(
        stream: &'a mut R
    ) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>> { ... }
fn write_ws<'a, W: Sink<Message, Error = Error> + Unpin + Send + 'a>(
        &'a self,
        sink: &'a mut W
    ) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
    where
        Self: Sync
, { ... }
fn read_warp<'a, R: Stream<Item = Result<Message, Error>> + Unpin + Send + 'a>(
        stream: &'a mut R
    ) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>> { ... }
fn write_warp<'a, W: Sink<Message, Error = Error> + Unpin + Send + 'a>(
        &'a self,
        sink: &'a mut W
    ) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
    where
        Self: Sync
, { ... } }

This trait allows reading a value of an implementing type from an async or sync stream, as well as writing one to an async or sync sink.

Required methods

fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
    stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
[src]

Reads a value of this type from an async stream.

fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
    &'a self,
    sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
[src]

Writes a value of this type to an async sink.

fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>[src]

Reads a value of this type from a sync stream.

fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>[src]

Writes a value of this type to a sync sink.

Loading content...

Provided methods

fn read_ws<'a, R: Stream<Item = Result<Message, Error>> + Unpin + Send + 'a>(
    stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
[src]

Reads a value of this type from a tokio-tungstenite websocket.

fn write_ws<'a, W: Sink<Message, Error = Error> + Unpin + Send + 'a>(
    &'a self,
    sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>> where
    Self: Sync
[src]

Writes a value of this type to a tokio-tungstenite websocket.

fn read_warp<'a, R: Stream<Item = Result<Message, Error>> + Unpin + Send + 'a>(
    stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
[src]

Reads a value of this type from a warp websocket.

fn write_warp<'a, W: Sink<Message, Error = Error> + Unpin + Send + 'a>(
    &'a self,
    sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>> where
    Self: Sync
[src]

Writes a value of this type to a warp websocket.

Loading content...

Implementations on Foreign Types

impl Protocol for Map<String, Value>[src]

impl Protocol for Number[src]

impl Protocol for Value[src]

impl Protocol for u8[src]

impl Protocol for i8[src]

impl Protocol for u16[src]

impl Protocol for i16[src]

impl Protocol for u32[src]

impl Protocol for i32[src]

impl Protocol for u64[src]

impl Protocol for i64[src]

impl Protocol for u128[src]

impl Protocol for i128[src]

impl Protocol for f32[src]

impl Protocol for f64[src]

impl Protocol for ()[src]

impl<A: Protocol + Send + Sync> Protocol for (A,)[src]

impl<A: Protocol + Send + Sync, B: Protocol + Send + Sync> Protocol for (A, B)[src]

impl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync> Protocol for (A, B, C)[src]

impl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync> Protocol for (A, B, C, D)[src]

impl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync, E: Protocol + Send + Sync> Protocol for (A, B, C, D, E)[src]

impl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync, E: Protocol + Send + Sync, F: Protocol + Send + Sync> Protocol for (A, B, C, D, E, F)[src]

impl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync, E: Protocol + Send + Sync, F: Protocol + Send + Sync, G: Protocol + Send + Sync> Protocol for (A, B, C, D, E, F, G)[src]

impl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync, E: Protocol + Send + Sync, F: Protocol + Send + Sync, G: Protocol + Send + Sync, H: Protocol + Send + Sync> Protocol for (A, B, C, D, E, F, G, H)[src]

impl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync, E: Protocol + Send + Sync, F: Protocol + Send + Sync, G: Protocol + Send + Sync, H: Protocol + Send + Sync, I: Protocol + Send + Sync> Protocol for (A, B, C, D, E, F, G, H, I)[src]

impl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync, E: Protocol + Send + Sync, F: Protocol + Send + Sync, G: Protocol + Send + Sync, H: Protocol + Send + Sync, I: Protocol + Send + Sync, J: Protocol + Send + Sync> Protocol for (A, B, C, D, E, F, G, H, I, J)[src]

impl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync, E: Protocol + Send + Sync, F: Protocol + Send + Sync, G: Protocol + Send + Sync, H: Protocol + Send + Sync, I: Protocol + Send + Sync, J: Protocol + Send + Sync, K: Protocol + Send + Sync> Protocol for (A, B, C, D, E, F, G, H, I, J, K)[src]

impl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync, E: Protocol + Send + Sync, F: Protocol + Send + Sync, G: Protocol + Send + Sync, H: Protocol + Send + Sync, I: Protocol + Send + Sync, J: Protocol + Send + Sync, K: Protocol + Send + Sync, L: Protocol + Send + Sync> Protocol for (A, B, C, D, E, F, G, H, I, J, K, L)[src]

impl<T> Protocol for [T; 0][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 1][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 2][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 3][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 4][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 5][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 6][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 7][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 8][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 9][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 10][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 11][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 12][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 13][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 14][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 15][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 16][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 17][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 18][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 19][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 20][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 21][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 22][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 23][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 24][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 25][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 26][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 27][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 28][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 29][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 30][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 31][src]

impl<T: Protocol + Send + Sync> Protocol for [T; 32][src]

impl Protocol for bool[src]

impl<T: Protocol + Sync> Protocol for Option<T>[src]

impl<T: Protocol + Send + Sync> Protocol for Vec<T>[src]

impl<T: Protocol + Ord + Send + Sync + 'static> Protocol for BTreeSet<T>[src]

impl<T: Protocol + Eq + Hash + Send + Sync> Protocol for HashSet<T>[src]

impl Protocol for String[src]

impl<K: Protocol + Ord + Send + Sync + 'static, V: Protocol + Send + Sync + 'static> Protocol for BTreeMap<K, V>[src]

impl<K: Protocol + Eq + Hash + Send + Sync, V: Protocol + Send + Sync> Protocol for HashMap<K, V>[src]

impl Protocol for Duration[src]

impl Protocol for Infallible[src]

Loading content...

Implementors

Loading content...