Struct Scalar
pub struct Scalar<T>(T)
where
T: Array;
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);
Tuple Fields§
§0: T
Implementations§
Trait Implementations§
impl<T> Copy for Scalar<T>
Auto Trait Implementations§
impl<T> Freeze for Scalar<T>where
T: Freeze,
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