Skip to content

Commit

Permalink
Add len() to InMemoryWriteableCursor (#564)
Browse files Browse the repository at this point in the history
* Add len() to InMemoryWriteableCursor

* Add is_empty to make clippy happy
  • Loading branch information
mosyp authored Jul 20, 2021
1 parent 03269aa commit 6c82bdc
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions parquet/src/util/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,18 @@ impl InMemoryWriteableCursor {
let inner = self.buffer.lock().unwrap();
inner.get_ref().to_vec()
}

/// Returns a length of the underlying buffer
pub fn len(&self) -> usize {
let inner = self.buffer.lock().unwrap();
inner.get_ref().len()
}

/// Returns true if the underlying buffer contains no elements
pub fn is_empty(&self) -> bool {
let inner = self.buffer.lock().unwrap();
inner.get_ref().is_empty()
}
}

impl TryClone for InMemoryWriteableCursor {
Expand Down

0 comments on commit 6c82bdc

Please sign in to comment.