pub trait TlsInputBuffer {
// Required methods
fn slice_mut(&mut self) -> &mut [u8] ⓘ;
fn discard(&mut self, num_bytes: usize);
fn received_close_notify(&mut self);
fn has_seen_eof(&self) -> bool;
}Expand description
An abstraction over received data buffers (either owned or borrowed)
Required Methods§
Sourcefn slice_mut(&mut self) -> &mut [u8] ⓘ
fn slice_mut(&mut self) -> &mut [u8] ⓘ
Return the buffer which contains the received data.
If no data is available, return the empty slice.
This is mutable, because the buffer is used for in-place decryption and coalescing of TLS records. Coalescing of TLS records can happen incrementally over multiple calls into rustls. As a result the contents of this buffer must not be altered except to add new bytes at the end.
Sourcefn discard(&mut self, num_bytes: usize)
fn discard(&mut self, num_bytes: usize)
Discard num_bytes from the front of the buffer returned by slice_mut().
Multiple calls to discard() are cumulative, rather than “last wins”. In
other words, discard(1) followed by discard(1) gives the same result
as discard(2).
The next call to slice_mut() must reflect all previous discard()s. In
other words, if slice_mut() returns slice [p..q], it should then
return [p+n..q] after discard(n).
Rustls guarantees it will not discard() more bytes than are returned
from slice_mut().
Sourcefn received_close_notify(&mut self)
fn received_close_notify(&mut self)
Signal that the connection has received a TLS close_notify alert.
The buffer should not accept any more data, because the peer has closed the connection.
Sourcefn has_seen_eof(&self) -> bool
fn has_seen_eof(&self) -> bool
Whether the buffer has seen a TCP EOF.
This is not a TCP-level event, but it is signalled to the TLS state via the input buffer.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".