mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-29 02:02:28 +00:00
Merge pull request #3050 from ant32/queue
add send_queue and recv_queue to embassy-net
This commit is contained in:
commit
72a5523c64
@ -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