Struct hypercore_protocol::Channel[][src]

pub struct Channel { /* fields omitted */ }

A protocol channel.

This is the handle that can be sent to other threads.

Implementations

impl Channel[src]

pub fn discovery_key(&self) -> &[u8; 32][src]

Get the discovery key of this channel.

pub fn key(&self) -> &[u8; 32][src]

Get the key of this channel.

pub fn id(&self) -> usize[src]

Get the local wire ID of this channel.

pub async fn send(&mut self, message: Message) -> Result<()>[src]

Send a message over the channel.

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

Register a protocol extension.

pub fn take_receiver(&mut self) -> Option<Receiver<Message>>[src]

Take the receiving part out of the channel.

After taking the receiver, this Channel will not emit messages when polled as a stream. The returned receiver will.

pub async fn status(&mut self, msg: Status) -> Result<()>[src]

Send a status message.

pub async fn options(&mut self, msg: Options) -> Result<()>[src]

Send a options message.

pub async fn have(&mut self, msg: Have) -> Result<()>[src]

Send a have message.

pub async fn unhave(&mut self, msg: Unhave) -> Result<()>[src]

Send a unhave message.

pub async fn want(&mut self, msg: Want) -> Result<()>[src]

Send a want message.

pub async fn unwant(&mut self, msg: Unwant) -> Result<()>[src]

Send a unwant message.

pub async fn request(&mut self, msg: Request) -> Result<()>[src]

Send a request message.

pub async fn cancel(&mut self, msg: Cancel) -> Result<()>[src]

Send a cancel message.

pub async fn data(&mut self, msg: Data) -> Result<()>[src]

Send a data message.

pub async fn close(&mut self, msg: Close) -> Result<()>[src]

Send a close message and close this channel.

Trait Implementations

impl Debug for Channel[src]

impl Stream for Channel[src]

type Item = Message

Values yielded by the stream.

Auto Trait Implementations

impl RefUnwindSafe for Channel

impl Send for Channel

impl Sync for Channel

impl Unpin for Channel

impl UnwindSafe for Channel

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<V, T> VZip<V> for T where
    V: MultiLane<T>,