Trait narrow::Array[][src]

pub trait Array {
    type Validity: ArrayData;
    fn validity(&self) -> &Self::Validity;

    fn len(&self) -> usize { ... }
fn is_empty(&self) -> bool { ... }
fn null_count(&self) -> usize { ... }
fn any_null(&self) -> bool { ... }
fn all_null(&self) -> bool { ... }
fn is_null(&self, index: usize) -> bool { ... }
fn valid_count(&self) -> usize { ... }
fn any_valid(&self) -> bool { ... }
fn all_valid(&self) -> bool { ... }
fn is_valid(&self, index: usize) -> bool { ... } }
Expand description

A sequence of values with known length all having the same type.

Associated Types

Validity of the array.

Required methods

Returns a reference to the Validity of the array.

Provided methods

Returns the number of elements in the array, also referred to as its length.

Examples

use narrow::{Array, Uint32Array};
let array: Uint32Array<false> = [1, 2, 3, 4].into_iter().collect();
assert_eq!(array.len(), 4);

Returns true if the array contains no elements.

Examples

use narrow::{Array, Uint32Array};
let empty: Uint32Array<false> = [].into_iter().collect();
assert!(empty.is_empty());

Returns the number of null elements.

Examples

use narrow::{Array, Uint32Array};
let array: Uint32Array<true> = [Some(1), None, Some(3), Some(4)].into_iter().collect();
assert_eq!(array.null_count(), 1);

Returns true if the array contains at least one null element.

Examples

use narrow::{Array, Uint32Array};
let array: Uint32Array<true> = [Some(1), None, Some(3), Some(4)].into_iter().collect();
assert!(array.any_null());

Returns true if all the elements in the array are null.

Examples

use narrow::{Array, Uint32Array};
let array: Uint32Array<true> = [None, None, None, None].into_iter().collect();
assert!(array.all_null());

Returns true if the element at position index is null.

Panics

Panics if index is out of bounds.

Examples

use narrow::{Array, Uint32Array};
let array: Uint32Array<true> = [Some(1), None, Some(3), Some(4)].into_iter().collect();
assert!(!array.is_null(0));
assert!(array.is_null(1));

Returns the number of valid elements.

Examples

use narrow::{Array, Uint32Array};
let array: Uint32Array<true> = [Some(1), None, Some(3), Some(4)].into_iter().collect();
assert_eq!(array.valid_count(), 3);

Returns true if the array contains at least one valid element.

Examples

use narrow::{Array, Uint32Array};
let array: Uint32Array<true> = [Some(1), None, Some(3), Some(4)].into_iter().collect();
assert!(array.any_valid());

Returns true if all the elements in the array are valid.

Examples

use narrow::{Array, Uint32Array};
let array: Uint32Array<true> = [Some(1), Some(2), Some(3), Some(4)].into_iter().collect();
assert!(array.all_valid());

Returns true if the element at position index is valid.

Panics

Panics if index is out of bounds.

Examples

use narrow::{Array, Uint32Array};
let array: Uint32Array<true> = [Some(1), None, Some(3), Some(4)].into_iter().collect();
assert!(array.is_valid(0));
assert!(!array.is_valid(1));

Implementors