Skip to content

Commit

Permalink
Rename RingBuffer#available to free. (#115)
Browse files Browse the repository at this point in the history
This avoids using the same name as recv_buffer_available_bytes.
  • Loading branch information
qwandor authored Oct 11, 2023
1 parent 9a6947e commit a812115
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/device/socket/connectionmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,15 +333,15 @@ impl RingBuffer {
}

/// Returns the number of bytes currently free in the buffer.
pub fn available(&self) -> usize {
pub fn free(&self) -> usize {
self.buffer.len() - self.used
}

/// Adds the given bytes to the buffer if there is enough capacity for them all.
///
/// Returns true if they were added, or false if they were not.
pub fn add(&mut self, bytes: &[u8]) -> bool {
if bytes.len() > self.available() {
if bytes.len() > self.free() {
return false;
}

Expand Down

0 comments on commit a812115

Please sign in to comment.