Struct hypercore_protocol::Extension[][src]

pub struct Extension { /* fields omitted */ }

A protocol extension.

An extension can be registered on either the Protocol stream or on any Channel. An extension is identified by a string. When both peers open an extension with the same name, the extensions are connected. Then, they function as a binary duplex stream. The stream is fully encrypted, but there’s no authentication performed on individual messages.

The Extension struct implements both AsyncRead and AsyncWrite and is also a Stream. You should use the extension either as a stream or as an async reader; if being used as both, the messages would appear in either poll randomly.

Implementations

impl Extension[src]

pub async fn send(&self, message: Vec<u8>)[src]

Send a message

Trait Implementations

impl AsyncRead for Extension[src]

impl AsyncWrite for Extension[src]

impl Clone for Extension[src]

impl Debug for Extension[src]

impl Stream for Extension[src]

type Item = Vec<u8>

Values yielded by the stream.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<R> AsyncReadExt for R where
    R: AsyncRead + ?Sized
[src]

impl<W> AsyncWriteExt for W where
    W: AsyncWrite + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<S> StreamExt for S where
    S: Stream + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,