You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by al...@apache.org on 2021/07/20 16:26:48 UTC

[arrow-rs] branch master updated: Add len() to InMemoryWriteableCursor (#564)

This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/master by this push:
     new 6c82bdc  Add len() to InMemoryWriteableCursor (#564)
6c82bdc is described below

commit 6c82bdc20cdb9d78b8985df4466da2934b7650b5
Author: Mykhailo Osypov <my...@gmail.com>
AuthorDate: Tue Jul 20 19:26:42 2021 +0300

    Add len() to InMemoryWriteableCursor (#564)
    
    * Add len() to InMemoryWriteableCursor
    
    * Add is_empty to make clippy happy
---
 parquet/src/util/cursor.rs | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/parquet/src/util/cursor.rs b/parquet/src/util/cursor.rs
index eaed6c7..c847fc8 100644
--- a/parquet/src/util/cursor.rs
+++ b/parquet/src/util/cursor.rs
@@ -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 {