pub enum Column {
Float(ArrayD<F>),
Int(ArrayD<I>),
Bool(ArrayD<bool>),
UInt(ArrayD<U>),
U8(ArrayD<u8>),
String(ArrayD<String>),
}Expand description
Internal enum representing a column of data in a Block.
This type is exposed in the public API but users typically don’t need to
interact with it directly. Instead, use the type-specific getters like
get_float(), get_int(), etc.
Variants§
Float(ArrayD<F>)
Floating point column using the compile-time scalar type F.
Int(ArrayD<I>)
Signed integer column using the compile-time scalar type I.
Bool(ArrayD<bool>)
Boolean column
UInt(ArrayD<U>)
Unsigned integer column using the compile-time scalar type U.
U8(ArrayD<u8>)
8-bit unsigned integer column
String(ArrayD<String>)
String column
Implementations§
Source§impl Column
impl Column
Sourcepub fn nrows(&self) -> Option<usize>
pub fn nrows(&self) -> Option<usize>
Returns the number of rows (axis-0 length) of this column.
Returns None if the array has rank 0 (which should never happen
in a valid Block, as rank-0 arrays are rejected during insertion).
Sourcepub fn as_float(&self) -> Option<&ArrayD<F>>
pub fn as_float(&self) -> Option<&ArrayD<F>>
Returns a reference to the float data, or None if this column is not Float.
Sourcepub fn as_float_mut(&mut self) -> Option<&mut ArrayD<F>>
pub fn as_float_mut(&mut self) -> Option<&mut ArrayD<F>>
Returns a mutable reference to the float data, or None if not Float.
Sourcepub fn as_int(&self) -> Option<&ArrayD<I>>
pub fn as_int(&self) -> Option<&ArrayD<I>>
Returns a reference to the integer data, or None if not Int.
Sourcepub fn as_int_mut(&mut self) -> Option<&mut ArrayD<I>>
pub fn as_int_mut(&mut self) -> Option<&mut ArrayD<I>>
Returns a mutable reference to the integer data, or None if not Int.
Sourcepub fn as_bool(&self) -> Option<&ArrayD<bool>>
pub fn as_bool(&self) -> Option<&ArrayD<bool>>
Returns a reference to the boolean data, or None if not Bool.
Sourcepub fn as_bool_mut(&mut self) -> Option<&mut ArrayD<bool>>
pub fn as_bool_mut(&mut self) -> Option<&mut ArrayD<bool>>
Returns a mutable reference to the boolean data, or None if not Bool.
Sourcepub fn as_uint(&self) -> Option<&ArrayD<U>>
pub fn as_uint(&self) -> Option<&ArrayD<U>>
Returns a reference to the unsigned integer data, or None if not UInt.
Sourcepub fn as_uint_mut(&mut self) -> Option<&mut ArrayD<U>>
pub fn as_uint_mut(&mut self) -> Option<&mut ArrayD<U>>
Returns a mutable reference to the unsigned integer data, or None if not UInt.
Sourcepub fn as_u8(&self) -> Option<&ArrayD<u8>>
pub fn as_u8(&self) -> Option<&ArrayD<u8>>
Returns a reference to the u8 data, or None if not U8.
Sourcepub fn as_u8_mut(&mut self) -> Option<&mut ArrayD<u8>>
pub fn as_u8_mut(&mut self) -> Option<&mut ArrayD<u8>>
Returns a mutable reference to the u8 data, or None if not U8.
Sourcepub fn as_string(&self) -> Option<&ArrayD<String>>
pub fn as_string(&self) -> Option<&ArrayD<String>>
Returns a reference to the string data, or None if not String.
Sourcepub fn as_string_mut(&mut self) -> Option<&mut ArrayD<String>>
pub fn as_string_mut(&mut self) -> Option<&mut ArrayD<String>>
Returns a mutable reference to the string data, or None if not String.
Sourcepub fn resize(&mut self, new_nrows: usize)
pub fn resize(&mut self, new_nrows: usize)
Resize this column along axis 0 to new_nrows.
- If
new_nrows< current nrows, slices to keep only the firstnew_nrowsrows. - If
new_nrows> current nrows, extends with default values (0.0 for Float, 0 for Int/UInt/U8, false for Bool, empty string for String). - If
new_nrows== current nrows, this is a no-op.
Only axis 0 is modified; trailing dimensions are preserved.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Column
impl RefUnwindSafe for Column
impl Send for Column
impl Sync for Column
impl Unpin for Column
impl UnsafeUnpin for Column
impl UnwindSafe for Column
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more