Struct datafusion_python::datafusion_common::arrow::array::Scalar
source · 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§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)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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