Struct arrow_array::Scalar
source · pub struct Scalar<T: Array>(/* private fields */);
Expand description
A wrapper around a single value Array
that implements
Datum
and indicates compute kernels should treat this array
as a scalar value (a single value).
Using a Scalar
is often much more efficient than creating an
Array
with the same (repeated) value.
See Datum
for more information.
Example
// Create a (typed) scalar for Int32Array for the value 42
let scalar = Scalar::new(Int32Array::from(vec![42]));
// Create a scalar using PrimtiveArray::scalar
let scalar = Int32Array::new_scalar(42);
// create a scalar from an ArrayRef (for dynamic typed Arrays)
let array: ArrayRef = get_array();
let scalar = Scalar::new(array);
Implementations§
Trait Implementations§
impl<T: Copy + Array> Copy for Scalar<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for Scalar<T>where T: RefUnwindSafe,
impl<T> Send for Scalar<T>
impl<T> Sync for Scalar<T>
impl<T> Unpin for Scalar<T>where T: Unpin,
impl<T> UnwindSafe for Scalar<T>where T: UnwindSafe,
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
Mutably borrows from an owned value. Read more