pub struct Scalar<T>(/* private fields */)
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);
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)