Struct hypercore_protocol::Protocol[][src]

pub struct Protocol<IO> { /* fields omitted */ }

A Protocol stream.

Implementations

impl<IO> Protocol<IO> where
    IO: AsyncWrite + AsyncRead + Send + Unpin + 'static, 
[src]

pub fn new(io: IO, options: Options) -> Self[src]

Create a new Protocol instance.

pub fn builder(is_initiator: bool) -> Builder[src]

Create a protocol builder.

pub fn is_initiator(&self) -> bool[src]

Whether this protocol stream initiated the underlying IO connection.

pub fn public_key(&self) -> Option<&[u8]>[src]

Get your own Noise public key.

Empty before the handshake completed.

pub fn remote_public_key(&self) -> Option<&[u8]>[src]

Get the remote’s Noise public key.

Empty before the handshake completed.

pub fn commands(&self) -> CommandTx[src]

Get a sender to send commands.

pub async fn command(&mut self, command: Command) -> Result<()>[src]

Give a command to the protocol.

pub async fn register_extension(&mut self, name: impl ToString) -> Extension[src]

Register a protocol extension on the stream.

pub async fn open(&mut self, key: Key) -> Result<()>[src]

Open a new protocol channel.

Once the other side proofed that it also knows the key, the channel is emitted as Event::Channel on the protocol event stream.

pub fn release(self) -> IO[src]

Stop the protocol and return the inner reader and writer.

Trait Implementations

impl<IO: Debug> Debug for Protocol<IO>[src]

impl<IO> Stream for Protocol<IO> where
    IO: AsyncRead + AsyncWrite + Send + Unpin + 'static, 
[src]

type Item = Result<Event>

Values yielded by the stream.

Auto Trait Implementations

impl<IO> !RefUnwindSafe for Protocol<IO>

impl<IO> Send for Protocol<IO> where
    IO: Send

impl<IO> Sync for Protocol<IO> where
    IO: Sync

impl<IO> Unpin for Protocol<IO> where
    IO: Unpin

impl<IO> !UnwindSafe for Protocol<IO>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?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, 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<S, T, E> TryStream for S where
    S: Stream<Item = Result<T, E>> + ?Sized

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future

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