pub struct RecvStep<'b, P: ReadPrecision> {
buffer: &'b mut Buffer<P>,
deficit: NonZeroUsize,
}
proxy-handshake
or client-handshake
only.Expand description
Next step - details for reading from the peer
Value in NextStep::Recv
.
Caller should read from the peer and call one of the received
functions.
Specifically, caller should do one of the following:
-
Read some data into the slice returned by
.buf()
, and then call.note_received()
. -
Determine the available buffer space with
.buf()
.len()
, write some data into the buffer’sunfilled_slice()
, and callBuffer::note_received
. This allows the caller to dispose of theRecvStep
(which mutably borrows theBuffer
) while reading, at the cost of slightly less correctness checking by the compiler.
The caller should not wait for enough data to fill the whole buf
.
Fields§
§buffer: &'b mut Buffer<P>
The buffer
deficit: NonZeroUsize
Lower bound on the number of bytes that the handshake needs to read to complete.
Useful only for callers that want to avoid reading beyond the end of the handshake.
Always <= .buf().len()
.
The returned value has the same semantics as
[tor_bytes::IncompleteMessage.deficit
.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<'b, P> Freeze for RecvStep<'b, P>
impl<'b, P> RefUnwindSafe for RecvStep<'b, P>where
P: RefUnwindSafe,
impl<'b, P> Send for RecvStep<'b, P>where
P: Send,
impl<'b, P> Sync for RecvStep<'b, P>where
P: Sync,
impl<'b, P> Unpin for RecvStep<'b, P>
impl<'b, P> !UnwindSafe for RecvStep<'b, P>
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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>
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>
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