Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doctests for BooleanArray. #338

Merged
merged 2 commits into from
May 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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