pub trait ReadPrecision:
ReadPrecisionSealed
+ Default
+ Copy
+ Debug { }
proxy-handshake
or client-handshake
only.Expand description
Markers indicating whether we’re allowing read-ahead,
The P
type parameter on [Buffer]
et al indicates
whether we are doing (only) precise reads:
()
for normal operation, with readahead;
PreciseReads
for reading small amounts as needed.
§Normal operation, P = ()
When the SOCKS protocol implementation wants to see more data,
[RecvStep::<()>::buf
] is all of the free space in the buffer.
The caller will typically read whatever data is available,
including possibly data sent by the peer after the end of the SOCKS handshake.
If so, that data will eventually be returned, after the handshake is complete,
by Finished::into_output_and_slice
or Finished::into_output_and_vec
.
§Avoiding read-ahead, P = PreciseReads
RecvStep::<PreciseReads>::buf()
is only as long as the SOCKS protocol implementation
knows that it needs.
Typically this is a very small buffer, often only one byte.
This means that a single protocol exchange will involve many iterations
each returning a RecvStep
,
and (depending on the caller) each implying one recv(2)
call or similar.
This is not very performant.
But it does allow the implementation to avoid reading ahead.
In this mode, Finished::into_output
is available,
which returns only the output.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.