mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-25 16:23:10 +00:00
add send_queue and recv_queue
This commit is contained in:
parent
044b5c8921
commit
673d11f49f
@ -98,6 +98,13 @@ impl<'a> TcpReader<'a> {
|
||||
pub fn recv_capacity(&self) -> usize {
|
||||
self.io.recv_capacity()
|
||||
}
|
||||
|
||||
/// Return the amount of octets queued in the receive buffer. This value can be larger than
|
||||
/// the slice read by the next `recv` or `peek` call because it includes all queued octets,
|
||||
/// and not only the octets that may be returned as a contiguous slice.
|
||||
pub fn recv_queue(&self) -> usize {
|
||||
self.io.recv_queue()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TcpWriter<'a> {
|
||||
@ -132,6 +139,11 @@ impl<'a> TcpWriter<'a> {
|
||||
pub fn send_capacity(&self) -> usize {
|
||||
self.io.send_capacity()
|
||||
}
|
||||
|
||||
/// Return the amount of octets queued in the transmit buffer.
|
||||
pub fn send_queue(&self) -> usize {
|
||||
self.io.send_queue()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TcpSocket<'a> {
|
||||
@ -163,6 +175,18 @@ impl<'a> TcpSocket<'a> {
|
||||
self.io.send_capacity()
|
||||
}
|
||||
|
||||
/// Return the amount of octets queued in the transmit buffer.
|
||||
pub fn send_queue(&self) -> usize {
|
||||
self.io.send_queue()
|
||||
}
|
||||
|
||||
/// Return the amount of octets queued in the receive buffer. This value can be larger than
|
||||
/// the slice read by the next `recv` or `peek` call because it includes all queued octets,
|
||||
/// and not only the octets that may be returned as a contiguous slice.
|
||||
pub fn recv_queue(&self) -> usize {
|
||||
self.io.recv_queue()
|
||||
}
|
||||
|
||||
/// Call `f` with the largest contiguous slice of octets in the transmit buffer,
|
||||
/// and enqueue the amount of elements returned by `f`.
|
||||
///
|
||||
@ -519,6 +543,14 @@ impl<'d> TcpIo<'d> {
|
||||
fn send_capacity(&self) -> usize {
|
||||
self.with(|s, _| s.send_capacity())
|
||||
}
|
||||
|
||||
fn send_queue(&self) -> usize {
|
||||
self.with(|s, _| s.send_queue())
|
||||
}
|
||||
|
||||
fn recv_queue(&self) -> usize {
|
||||
self.with(|s, _| s.recv_queue())
|
||||
}
|
||||
}
|
||||
|
||||
mod embedded_io_impls {
|
||||
|
Loading…
Reference in New Issue
Block a user