Skip to content

Commit

Permalink
Doctests for BooleanArray. (#338) (#359)
Browse files Browse the repository at this point in the history
* Doctests for BooleanArray.

* Update arrow/src/array/array_boolean.rs

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>

Co-authored-by: Navin <navin@novemberkilo.com>
  • Loading branch information
alamb and novemberkilo authored May 26, 2021
1 parent 9e15050 commit 0817783
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions arrow/src/array/array_boolean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,27 @@ use crate::buffer::{Buffer, MutableBuffer};
use crate::util::bit_util;

/// Array of bools
///
/// # Example
///
/// ```
/// use arrow::array::{Array, BooleanArray};
/// let arr = BooleanArray::from(vec![Some(false), Some(true), None, Some(true)]);
/// assert_eq!(4, arr.len());
/// assert_eq!(1, arr.null_count());
/// assert!(arr.is_valid(0));
/// assert!(!arr.is_null(0));
/// assert_eq!(false, arr.value(0));
/// assert!(arr.is_valid(1));
/// assert!(!arr.is_null(1));
/// assert_eq!(true, arr.value(1));
/// assert!(!arr.is_valid(2));
/// assert!(arr.is_null(2));
/// assert!(arr.is_valid(3));
/// assert!(!arr.is_null(3));
/// assert_eq!(true, arr.value(3));
/// ```
///
pub struct BooleanArray {
data: ArrayData,
/// Pointer to the value array. The lifetime of this must be <= to the value buffer
Expand Down

0 comments on commit 0817783

Please sign in to comment.