pub struct UnauthedP2PStream<S> { /* private fields */ }Expand description
Implementations§
Source§impl<S> UnauthedP2PStream<S>
impl<S> UnauthedP2PStream<S>
Sourcepub const fn new(inner: S) -> Self
pub const fn new(inner: S) -> Self
Create a new UnauthedP2PStream from a type S which implements Stream and Sink.
Sourcepub const fn with_max_payload_size(self, max_payload_size: usize) -> Self
pub const fn with_max_payload_size(self, max_payload_size: usize) -> Self
Sets the maximum size of an uncompressed message payload, which defaults to
MAX_PAYLOAD_SIZE.
The limit applies to the handshake and to every message of the P2PStream it yields, in
both directions.
Source§impl<S> UnauthedP2PStream<S>
impl<S> UnauthedP2PStream<S>
Sourcepub async fn handshake(
self,
hello: HelloMessageWithProtocols,
) -> Result<(P2PStream<S>, HelloMessage), P2PStreamError>
pub async fn handshake( self, hello: HelloMessageWithProtocols, ) -> Result<(P2PStream<S>, HelloMessage), P2PStreamError>
Consumes the UnauthedP2PStream and returns a P2PStream after the Hello handshake is
completed successfully. This also returns the Hello message sent by the remote peer.
Source§impl<S> UnauthedP2PStream<S>
impl<S> UnauthedP2PStream<S>
Sourcepub async fn send_disconnect(
&mut self,
reason: DisconnectReason,
) -> Result<(), P2PStreamError>
pub async fn send_disconnect( &mut self, reason: DisconnectReason, ) -> Result<(), P2PStreamError>
Send a disconnect message during the handshake. This is sent without snappy compression.
Trait Implementations§
Source§impl<S: Debug> Debug for UnauthedP2PStream<S>
impl<S: Debug> Debug for UnauthedP2PStream<S>
impl<'pin, S> Unpin for UnauthedP2PStream<S>where
PinnedFieldsOf<__UnauthedP2PStream<'pin, S>>: Unpin,
Auto Trait Implementations§
impl<S> Freeze for UnauthedP2PStream<S>where
S: Freeze,
impl<S> RefUnwindSafe for UnauthedP2PStream<S>where
S: RefUnwindSafe,
impl<S> Send for UnauthedP2PStream<S>where
S: Send,
impl<S> Sync for UnauthedP2PStream<S>where
S: Sync,
impl<S> UnsafeUnpin for UnauthedP2PStream<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for UnauthedP2PStream<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.