Struct vortex_scalar::Scalar
source · pub struct Scalar { /* private fields */ }
Expand description
A single logical item, composed of both a ScalarValue
and a logical [DType
].
A ScalarValue
is opaque, and should be accessed via one of the type-specific scalar wrappers
for example BoolScalar
, PrimitiveScalar
, etc.
Note: PartialEq
and PartialOrd
are implemented only for an exact match of the scalar’s
dtype, including nullability.
Implementations§
source§impl Scalar
impl Scalar
pub fn new(dtype: DType, value: ScalarValue) -> Self
pub fn dtype(&self) -> &DType
pub fn into_parts(self) -> (DType, ScalarValue)
pub fn into_value(self) -> ScalarValue
pub fn is_valid(&self) -> bool
pub fn is_null(&self) -> bool
pub fn null(dtype: DType) -> Self
pub fn null_typed<T: ScalarType>() -> Self
pub fn cast(&self, dtype: &DType) -> VortexResult<Self>
pub fn into_nullable(self) -> Self
source§impl Scalar
impl Scalar
pub fn as_bool(&self) -> BoolScalar<'_>
pub fn as_bool_opt(&self) -> Option<BoolScalar<'_>>
pub fn as_primitive(&self) -> PrimitiveScalar<'_>
pub fn as_primitive_opt(&self) -> Option<PrimitiveScalar<'_>>
pub fn as_utf8(&self) -> Utf8Scalar<'_>
pub fn as_utf8_opt(&self) -> Option<Utf8Scalar<'_>>
pub fn as_binary(&self) -> BinaryScalar<'_>
pub fn as_binary_opt(&self) -> Option<BinaryScalar<'_>>
pub fn as_struct(&self) -> StructScalar<'_>
pub fn as_struct_opt(&self) -> Option<StructScalar<'_>>
pub fn as_list(&self) -> ListScalar<'_>
pub fn as_list_opt(&self) -> Option<ListScalar<'_>>
pub fn as_extension(&self) -> ExtScalar<'_>
pub fn as_extension_opt(&self) -> Option<ExtScalar<'_>>
Trait Implementations§
source§impl<'de> Deserialize<'de> for Scalar
impl<'de> Deserialize<'de> for Scalar
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<PrimitiveScalar<'_>> for Scalar
impl From<PrimitiveScalar<'_>> for Scalar
source§fn from(pscalar: PrimitiveScalar<'_>) -> Self
fn from(pscalar: PrimitiveScalar<'_>) -> Self
Converts to this type from the input type.
source§impl From<usize> for Scalar
impl From<usize> for Scalar
Read a scalar as usize. For usize only, we implicitly cast for better ergonomics.
source§impl PartialOrd for Scalar
impl PartialOrd for Scalar
source§impl<'a> TryFrom<&'a Scalar> for BinaryScalar<'a>
impl<'a> TryFrom<&'a Scalar> for BinaryScalar<'a>
source§impl<'a> TryFrom<&'a Scalar> for BoolScalar<'a>
impl<'a> TryFrom<&'a Scalar> for BoolScalar<'a>
source§impl<'a> TryFrom<&'a Scalar> for ListScalar<'a>
impl<'a> TryFrom<&'a Scalar> for ListScalar<'a>
source§impl<'a> TryFrom<&'a Scalar> for PrimitiveScalar<'a>
impl<'a> TryFrom<&'a Scalar> for PrimitiveScalar<'a>
source§impl<'a> TryFrom<&'a Scalar> for StructScalar<'a>
impl<'a> TryFrom<&'a Scalar> for StructScalar<'a>
source§impl<'a> TryFrom<&'a Scalar> for Utf8Scalar<'a>
impl<'a> TryFrom<&'a Scalar> for Utf8Scalar<'a>
source§impl TryFrom<&Scalar> for usize
impl TryFrom<&Scalar> for usize
Read a scalar as usize. For usize only, we implicitly cast for better ergonomics.
Auto Trait Implementations§
impl !Freeze for Scalar
impl RefUnwindSafe for Scalar
impl Send for Scalar
impl Sync for Scalar
impl Unpin for Scalar
impl UnwindSafe for Scalar
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
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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