[−][src]Struct hypercore_protocol::Protocol
A Protocol stream.
Implementations
impl<R, W> Protocol<R, W> where
R: AsyncRead + Send + Unpin + 'static,
W: AsyncWrite + Send + Unpin + 'static,
[src]
R: AsyncRead + Send + Unpin + 'static,
W: AsyncWrite + Send + Unpin + 'static,
pub fn new(reader: R, writer: W, options: ProtocolOptions) -> Self
[src]
Create a new Protocol instance.
pub fn builder(is_initiator: bool) -> ProtocolBuilder
[src]
Create a protocol builder.
pub fn is_initiator(&self) -> bool
[src]
pub async fn loop_next<'_>(&'_ mut self) -> Result<Event>
[src]
Wait for the next protocol event.
This function should be called in a loop until this returns an error.
pub fn remote_key(&self) -> Option<&[u8]>
[src]
Get the peer's Noise public key.
Empty before the handshake completed.
pub fn destroy(&mut self, error: Error)
[src]
Destroy the protocol instance with an error.
pub async fn open<'_>(&'_ mut self, key: Vec<u8>) -> 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) -> (R, W)
[src]
Stop the protocol and return the inner reader and writer.
pub fn into_stream(self) -> ProtocolStream<R, W>
[src]
pub fn control(&self) -> ControlTx
[src]
Get a sender to send control events.
Auto Trait Implementations
impl<R, W> !RefUnwindSafe for Protocol<R, W>
impl<R, W> Send for Protocol<R, W>
impl<R, W> !Sync for Protocol<R, W>
impl<R, W> Unpin for Protocol<R, W>
impl<R, W> !UnwindSafe for Protocol<R, W>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,