[][src]Struct libp2p_secio::SecioMiddleware

pub struct SecioMiddleware<S> { /* fields omitted */ }

Wraps around an object that implements AsyncRead and AsyncWrite.

Implements Sink and Stream whose items are frames of data. Each frame is encoded individually, so you are encouraged to group data in few frames if possible.

Methods

impl<S> SecioMiddleware<S> where
    S: AsyncRead + AsyncWrite + Send
[src]

pub fn handshake(
    socket: S,
    config: SecioConfig
) -> impl Future<Item = (SecioMiddleware<S>, PublicKey, Vec<u8>), Error = SecioError>
[src]

Attempts to perform a handshake on the given socket.

On success, produces a SecioMiddleware that can then be used to encode/decode communications, plus the public key of the remote, plus the ephemeral public key.

Trait Implementations

impl<S> Stream for SecioMiddleware<S> where
    S: AsyncRead + AsyncWrite
[src]

type Item = Vec<u8>

The type of item this stream will yield on success.

type Error = SecioError

The type of error this stream may generate.

impl<S> Sink for SecioMiddleware<S> where
    S: AsyncRead + AsyncWrite
[src]

type SinkItem = BytesMut

The type of value that the sink accepts.

type SinkError = Error

The type of value produced by the sink when an error occurs.

Auto Trait Implementations

impl<S> Send for SecioMiddleware<S> where
    S: Send

impl<S> !Sync for SecioMiddleware<S>

impl<S> Unpin for SecioMiddleware<S> where
    S: Unpin

impl<S> !UnwindSafe for SecioMiddleware<S>

impl<S> !RefUnwindSafe for SecioMiddleware<S>

Blanket Implementations

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

impl<T> From<T> for T[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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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