pub struct Scalar { /* private fields */ }Expand description
Implementations§
Source§impl Scalar
impl Scalar
Sourcepub fn cast(&self, target_dtype: &DType) -> VortexResult<Scalar>
pub fn cast(&self, target_dtype: &DType) -> VortexResult<Scalar>
Cast this scalar to another data type.
§Errors
Returns an error if the cast is not supported or if a null value is cast to a non-nullable type.
Sourcepub fn into_nullable(self) -> Scalar
pub fn into_nullable(self) -> Scalar
Cast the scalar into a nullable version of its current type.
Source§impl Scalar
impl Scalar
Sourcepub fn bool(value: bool, nullability: Nullability) -> Self
pub fn bool(value: bool, nullability: Nullability) -> Self
Creates a new boolean scalar with the given value and nullability.
Sourcepub fn primitive<T: NativePType + Into<PValue>>(
value: T,
nullability: Nullability,
) -> Self
pub fn primitive<T: NativePType + Into<PValue>>( value: T, nullability: Nullability, ) -> Self
Creates a new primitive scalar from a native value.
Sourcepub fn primitive_value(
value: PValue,
ptype: PType,
nullability: Nullability,
) -> Self
pub fn primitive_value( value: PValue, ptype: PType, nullability: Nullability, ) -> Self
Create a PrimitiveScalar from a PValue.
Note that an explicit PType is passed since any compatible PValue may be used as the value for a primitive type.
Sourcepub fn decimal(
value: DecimalValue,
decimal_type: DecimalDType,
nullability: Nullability,
) -> Self
pub fn decimal( value: DecimalValue, decimal_type: DecimalDType, nullability: Nullability, ) -> Self
Creates a new decimal scalar with the given value, precision, scale, and nullability.
Sourcepub fn utf8<B>(str: B, nullability: Nullability) -> Selfwhere
B: Into<BufferString>,
pub fn utf8<B>(str: B, nullability: Nullability) -> Selfwhere
B: Into<BufferString>,
Creates a new UTF-8 scalar from a string-like value.
§Panics
Panics if the input cannot be converted to a valid UTF-8 string.
Sourcepub fn try_utf8<B>(
str: B,
nullability: Nullability,
) -> Result<Self, <B as TryInto<BufferString>>::Error>where
B: TryInto<BufferString>,
pub fn try_utf8<B>(
str: B,
nullability: Nullability,
) -> Result<Self, <B as TryInto<BufferString>>::Error>where
B: TryInto<BufferString>,
Tries to create a new UTF-8 scalar from a string-like value.
§Errors
Returns an error if the input cannot be converted to a valid UTF-8 string.
Sourcepub fn binary(buffer: impl Into<ByteBuffer>, nullability: Nullability) -> Self
pub fn binary(buffer: impl Into<ByteBuffer>, nullability: Nullability) -> Self
Creates a new binary scalar from a byte buffer.
Sourcepub fn list(
element_dtype: impl Into<Arc<DType>>,
children: Vec<Scalar>,
nullability: Nullability,
) -> Self
pub fn list( element_dtype: impl Into<Arc<DType>>, children: Vec<Scalar>, nullability: Nullability, ) -> Self
Creates a new list scalar with the given element type and children.
§Panics
Panics if any child scalar has a different type than the element type, or if there are too many children.
Sourcepub fn list_empty(element_dtype: Arc<DType>, nullability: Nullability) -> Self
pub fn list_empty(element_dtype: Arc<DType>, nullability: Nullability) -> Self
Creates a new empty list scalar with the given element type.
Sourcepub fn fixed_size_list(
element_dtype: impl Into<Arc<DType>>,
children: Vec<Scalar>,
nullability: Nullability,
) -> Self
pub fn fixed_size_list( element_dtype: impl Into<Arc<DType>>, children: Vec<Scalar>, nullability: Nullability, ) -> Self
Creates a new fixed-size list scalar with the given element type and children.
§Panics
Panics if any child scalar has a different type than the element type, or if there are too many children.
Sourcepub fn extension<V: ExtDTypeVTable + Default>(
options: V::Metadata,
value: Scalar,
) -> Self
pub fn extension<V: ExtDTypeVTable + Default>( options: V::Metadata, value: Scalar, ) -> Self
Creates a new extension scalar wrapping the given storage value.
Sourcepub fn extension_ref(ext_dtype: ExtDTypeRef, value: Scalar) -> Self
pub fn extension_ref(ext_dtype: ExtDTypeRef, value: Scalar) -> Self
Creates a new extension scalar wrapping the given storage value.
§Panics
Panics if the storage dtype of ext_dtype does not match value’s dtype.
Source§impl Scalar
impl Scalar
Sourcepub fn as_bool(&self) -> BoolScalar<'_>
pub fn as_bool(&self) -> BoolScalar<'_>
Sourcepub fn as_bool_opt(&self) -> Option<BoolScalar<'_>>
pub fn as_bool_opt(&self) -> Option<BoolScalar<'_>>
Returns a view of the scalar as a boolean scalar if it has a boolean type.
Sourcepub fn as_primitive(&self) -> PrimitiveScalar<'_>
pub fn as_primitive(&self) -> PrimitiveScalar<'_>
Sourcepub fn as_primitive_opt(&self) -> Option<PrimitiveScalar<'_>>
pub fn as_primitive_opt(&self) -> Option<PrimitiveScalar<'_>>
Returns a view of the scalar as a primitive scalar if it has a primitive type.
Sourcepub fn as_decimal(&self) -> DecimalScalar<'_>
pub fn as_decimal(&self) -> DecimalScalar<'_>
Sourcepub fn as_decimal_opt(&self) -> Option<DecimalScalar<'_>>
pub fn as_decimal_opt(&self) -> Option<DecimalScalar<'_>>
Returns a view of the scalar as a decimal scalar if it has a decimal type.
Sourcepub fn as_utf8(&self) -> Utf8Scalar<'_>
pub fn as_utf8(&self) -> Utf8Scalar<'_>
Sourcepub fn as_utf8_opt(&self) -> Option<Utf8Scalar<'_>>
pub fn as_utf8_opt(&self) -> Option<Utf8Scalar<'_>>
Returns a view of the scalar as a UTF-8 string scalar if it has a UTF-8 type.
Sourcepub fn as_binary(&self) -> BinaryScalar<'_>
pub fn as_binary(&self) -> BinaryScalar<'_>
Sourcepub fn as_binary_opt(&self) -> Option<BinaryScalar<'_>>
pub fn as_binary_opt(&self) -> Option<BinaryScalar<'_>>
Returns a view of the scalar as a binary scalar if it has a binary type.
Sourcepub fn as_struct(&self) -> StructScalar<'_>
pub fn as_struct(&self) -> StructScalar<'_>
Sourcepub fn as_struct_opt(&self) -> Option<StructScalar<'_>>
pub fn as_struct_opt(&self) -> Option<StructScalar<'_>>
Returns a view of the scalar as a struct scalar if it has a struct type.
Sourcepub fn as_list(&self) -> ListScalar<'_>
pub fn as_list(&self) -> ListScalar<'_>
Returns a view of the scalar as a list scalar.
Note that we use ListScalar to represent both List and
FixedSizeList.
§Panics
Panics if the scalar does not have a List or FixedSizeList type.
Sourcepub fn as_list_opt(&self) -> Option<ListScalar<'_>>
pub fn as_list_opt(&self) -> Option<ListScalar<'_>>
Returns a view of the scalar as a list scalar if it has a list type.
Note that we use ListScalar to represent both List and
FixedSizeList.
Sourcepub fn as_extension(&self) -> ExtScalar<'_>
pub fn as_extension(&self) -> ExtScalar<'_>
Sourcepub fn as_extension_opt(&self) -> Option<ExtScalar<'_>>
pub fn as_extension_opt(&self) -> Option<ExtScalar<'_>>
Returns a view of the scalar as an extension scalar if it has an extension type.
Source§impl Scalar
impl Scalar
Sourcepub fn from_proto_value(
value: &ScalarValue,
dtype: &DType,
) -> VortexResult<Self>
pub fn from_proto_value( value: &ScalarValue, dtype: &DType, ) -> VortexResult<Self>
Creates a Scalar from a protobuf ScalarValue representation.
Note that we need to provide a DType since protobuf serialization only supports 64-bit
integers, and serializing into protobuf loses that type information.
§Errors
Returns an error if type validation fails.
Sourcepub fn from_proto(value: &Scalar, session: &VortexSession) -> VortexResult<Self>
pub fn from_proto(value: &Scalar, session: &VortexSession) -> VortexResult<Self>
Source§impl Scalar
impl Scalar
Sourcepub fn null_native<T: NativeDType>() -> Self
pub fn null_native<T: NativeDType>() -> Self
Creates a new null Scalar for the given scalar type.
The resulting scalar will have a nullable version of the type’s data type.
Sourcepub fn try_new(dtype: DType, value: Option<ScalarValue>) -> VortexResult<Self>
pub fn try_new(dtype: DType, value: Option<ScalarValue>) -> VortexResult<Self>
Attempts to create a new Scalar with the given DType and potentially null
ScalarValue.
§Errors
Returns an error if the given DType and ScalarValue are incompatible.
Sourcepub unsafe fn new_unchecked(dtype: DType, value: Option<ScalarValue>) -> Self
pub unsafe fn new_unchecked(dtype: DType, value: Option<ScalarValue>) -> Self
Creates a new Scalar with the given DType and potentially null ScalarValue
without checking compatibility.
§Safety
The caller must ensure that the given DType and ScalarValue are compatible per the
rules defined in Self::is_compatible.
Sourcepub fn default_value(dtype: &DType) -> Self
pub fn default_value(dtype: &DType) -> Self
Returns a default value for the given DType.
For nullable types, this returns a null scalar. For non-nullable and non-nested types, this returns the zero value for the type.
For non-nullable and nested types that may need null values in their children (as of right
now, that is only FixedSizeList and Struct), this function will provide null default
children.
See ScalarValue::zero_value for more details about “zero” values.
Sourcepub fn zero_value(dtype: &DType) -> Self
pub fn zero_value(dtype: &DType) -> Self
Returns a non-null zero / identity value for the given DType.
See ScalarValue::zero_value for more details about “zero” values.
Sourcepub fn is_compatible(dtype: &DType, value: Option<&ScalarValue>) -> bool
pub fn is_compatible(dtype: &DType, value: Option<&ScalarValue>) -> bool
Check if the given ScalarValue is compatible with the given DType.
Sourcepub fn eq_ignore_nullability(&self, other: &Self) -> bool
pub fn eq_ignore_nullability(&self, other: &Self) -> bool
Check if two scalars are equal, ignoring nullability of the DType.
Sourcepub fn into_parts(self) -> (DType, Option<ScalarValue>)
pub fn into_parts(self) -> (DType, Option<ScalarValue>)
Returns the parts of the Scalar.
Sourcepub fn value(&self) -> Option<&ScalarValue>
pub fn value(&self) -> Option<&ScalarValue>
Returns an optional ScalarValue of the Scalar, where None means the value is null.
Sourcepub fn into_value(self) -> Option<ScalarValue>
pub fn into_value(self) -> Option<ScalarValue>
Returns the internal optional ScalarValue, where None means the value is null,
consuming the Scalar.
Sourcepub fn is_zero(&self) -> Option<bool>
pub fn is_zero(&self) -> Option<bool>
Returns true if the Scalar has a non-null zero value.
Returns None if the scalar is null, otherwise returns Some(true) if the value is zero
and Some(false) otherwise.
Sourcepub fn primitive_reinterpret_cast(&self, ptype: PType) -> VortexResult<Self>
pub fn primitive_reinterpret_cast(&self, ptype: PType) -> VortexResult<Self>
Reinterprets the bytes of this scalar as a different primitive type.
§Errors
Panics if the scalar is not a primitive type or if the types have different byte widths.
Trait Implementations§
Source§impl From<Buffer<u8>> for Scalar
impl From<Buffer<u8>> for Scalar
Source§fn from(value: ByteBuffer) -> Self
fn from(value: ByteBuffer) -> Self
Source§impl From<BufferString> for Scalar
impl From<BufferString> for Scalar
Source§fn from(value: BufferString) -> Self
fn from(value: BufferString) -> Self
Source§impl From<DecimalScalar<'_>> for Scalar
impl From<DecimalScalar<'_>> for Scalar
Source§fn from(ds: DecimalScalar<'_>) -> Self
fn from(ds: DecimalScalar<'_>) -> Self
Source§impl From<DecimalValue> for Scalar
impl From<DecimalValue> for Scalar
Source§fn from(value: DecimalValue) -> Self
fn from(value: DecimalValue) -> Self
Source§impl From<Option<Buffer<u8>>> for Scalar
impl From<Option<Buffer<u8>>> for Scalar
Source§fn from(value: Option<ByteBuffer>) -> Self
fn from(value: Option<ByteBuffer>) -> Self
Source§impl From<Option<BufferString>> for Scalar
impl From<Option<BufferString>> for Scalar
Source§fn from(value: Option<BufferString>) -> Self
fn from(value: Option<BufferString>) -> Self
Source§impl From<Option<DecimalValue>> for Scalar
impl From<Option<DecimalValue>> for Scalar
Source§fn from(value: Option<DecimalValue>) -> Self
fn from(value: Option<DecimalValue>) -> Self
Source§impl From<PrimitiveScalar<'_>> for Scalar
impl From<PrimitiveScalar<'_>> for Scalar
Source§fn from(ps: PrimitiveScalar<'_>) -> Self
fn from(ps: PrimitiveScalar<'_>) -> Self
Source§impl Hash for Scalar
We implement Hash manually to be consistent with PartialEq. Since we ignore nullability
in equality comparisons, we must also ignore it when hashing to maintain the invariant that
equal values have equal hashes.
impl Hash for Scalar
We implement Hash manually to be consistent with PartialEq. Since we ignore nullability
in equality comparisons, we must also ignore it when hashing to maintain the invariant that
equal values have equal hashes.
Source§impl IndexOrd<Scalar> for dyn Array + '_
impl IndexOrd<Scalar> for dyn Array + '_
Source§fn index_cmp(&self, idx: usize, elem: &Scalar) -> VortexResult<Option<Ordering>>
fn index_cmp(&self, idx: usize, elem: &Scalar) -> VortexResult<Option<Ordering>>
idx with elem.
For example, if self[idx] > elem, return Some(Greater).fn index_lt(&self, idx: usize, elem: &V) -> VortexResult<bool>
fn index_le(&self, idx: usize, elem: &V) -> VortexResult<bool>
fn index_gt(&self, idx: usize, elem: &V) -> VortexResult<bool>
fn index_ge(&self, idx: usize, elem: &V) -> VortexResult<bool>
Source§impl PartialEq for Scalar
We implement PartialEq manually because we want to ignore nullability when comparing scalars.
Two scalars with the same value but different nullability should be considered equal.
impl PartialEq for Scalar
We implement PartialEq manually because we want to ignore nullability when comparing scalars.
Two scalars with the same value but different nullability should be considered equal.
Source§impl PartialOrd for Scalar
impl PartialOrd for Scalar
Source§fn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
Compares two scalar values for ordering.
§Returns
Some(Ordering)if both scalars have the same data type (ignoring nullability)Noneif the scalars have different data types
§Ordering Rules
When types match, the ordering follows these rules:
- Null values are considered less than all non-null values
- Non-null values are compared according to their natural ordering
§Examples
// Same types compare successfully
let a = Scalar::primitive(10i32, Nullability::NonNullable);
let b = Scalar::primitive(20i32, Nullability::NonNullable);
assert_eq!(a.partial_cmp(&b), Some(Ordering::Less));
// Different types return None
let int_scalar = Scalar::primitive(10i32, Nullability::NonNullable);
let str_scalar = Scalar::utf8("hello", Nullability::NonNullable);
assert_eq!(int_scalar.partial_cmp(&str_scalar), None);
// Nulls are less than non-nulls
let null = Scalar::null(DType::Primitive(PType::I32, Nullability::Nullable));
let value = Scalar::primitive(0i32, Nullability::Nullable);
assert_eq!(null.partial_cmp(&value), Some(Ordering::Less));Source§impl<'a> TryFrom<&'a Scalar> for BinaryScalar<'a>
impl<'a> TryFrom<&'a Scalar> for BinaryScalar<'a>
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &'a Scalar) -> VortexResult<Self>
fn try_from(value: &'a Scalar) -> VortexResult<Self>
Source§impl<'a> TryFrom<&'a Scalar> for BoolScalar<'a>
impl<'a> TryFrom<&'a Scalar> for BoolScalar<'a>
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &'a Scalar) -> VortexResult<Self>
fn try_from(value: &'a Scalar) -> VortexResult<Self>
Source§impl<'a> TryFrom<&'a Scalar> for ByteBuffer
impl<'a> TryFrom<&'a Scalar> for ByteBuffer
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(scalar: &'a Scalar) -> VortexResult<Self>
fn try_from(scalar: &'a Scalar) -> VortexResult<Self>
Source§impl<'a> TryFrom<&'a Scalar> for BufferString
impl<'a> TryFrom<&'a Scalar> for BufferString
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(scalar: &'a Scalar) -> VortexResult<Self>
fn try_from(scalar: &'a Scalar) -> VortexResult<Self>
Source§impl<'a> TryFrom<&'a Scalar> for DecimalScalar<'a>
impl<'a> TryFrom<&'a Scalar> for DecimalScalar<'a>
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &'a Scalar) -> VortexResult<Self>
fn try_from(value: &'a Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for DecimalValue
impl TryFrom<&Scalar> for DecimalValue
Source§impl<'a> TryFrom<&'a Scalar> for ExtScalar<'a>
impl<'a> TryFrom<&'a Scalar> for ExtScalar<'a>
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &'a Scalar) -> VortexResult<Self>
fn try_from(value: &'a Scalar) -> VortexResult<Self>
Source§impl<'a> TryFrom<&'a Scalar> for ListScalar<'a>
impl<'a> TryFrom<&'a Scalar> for ListScalar<'a>
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &'a Scalar) -> VortexResult<Self>
fn try_from(value: &'a Scalar) -> VortexResult<Self>
Source§impl<'a> TryFrom<&'a Scalar> for Option<ByteBuffer>
impl<'a> TryFrom<&'a Scalar> for Option<ByteBuffer>
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(scalar: &'a Scalar) -> VortexResult<Self>
fn try_from(scalar: &'a Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for Option<bool>
impl TryFrom<&Scalar> for Option<bool>
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &Scalar) -> VortexResult<Self>
fn try_from(value: &Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for Option<f16>
Fallible conversion from a Scalar into an Option<T>.
impl TryFrom<&Scalar> for Option<f16>
Fallible conversion from a Scalar into an Option<T>.
§Errors
Returns an error if the Scalar is not primitive, or if it is unable to convert the
Scalar into the target type.
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &Scalar) -> VortexResult<Self>
fn try_from(value: &Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for Option<f32>
Fallible conversion from a Scalar into an Option<T>.
impl TryFrom<&Scalar> for Option<f32>
Fallible conversion from a Scalar into an Option<T>.
§Errors
Returns an error if the Scalar is not primitive, or if it is unable to convert the
Scalar into the target type.
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &Scalar) -> VortexResult<Self>
fn try_from(value: &Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for Option<f64>
Fallible conversion from a Scalar into an Option<T>.
impl TryFrom<&Scalar> for Option<f64>
Fallible conversion from a Scalar into an Option<T>.
§Errors
Returns an error if the Scalar is not primitive, or if it is unable to convert the
Scalar into the target type.
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &Scalar) -> VortexResult<Self>
fn try_from(value: &Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for Option<i16>
Fallible conversion from a Scalar into an Option<T>.
impl TryFrom<&Scalar> for Option<i16>
Fallible conversion from a Scalar into an Option<T>.
§Errors
Returns an error if the Scalar is not primitive, or if it is unable to convert the
Scalar into the target type.
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &Scalar) -> VortexResult<Self>
fn try_from(value: &Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for Option<i32>
Fallible conversion from a Scalar into an Option<T>.
impl TryFrom<&Scalar> for Option<i32>
Fallible conversion from a Scalar into an Option<T>.
§Errors
Returns an error if the Scalar is not primitive, or if it is unable to convert the
Scalar into the target type.
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &Scalar) -> VortexResult<Self>
fn try_from(value: &Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for Option<i64>
Fallible conversion from a Scalar into an Option<T>.
impl TryFrom<&Scalar> for Option<i64>
Fallible conversion from a Scalar into an Option<T>.
§Errors
Returns an error if the Scalar is not primitive, or if it is unable to convert the
Scalar into the target type.
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &Scalar) -> VortexResult<Self>
fn try_from(value: &Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for Option<i8>
Fallible conversion from a Scalar into an Option<T>.
impl TryFrom<&Scalar> for Option<i8>
Fallible conversion from a Scalar into an Option<T>.
§Errors
Returns an error if the Scalar is not primitive, or if it is unable to convert the
Scalar into the target type.
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &Scalar) -> VortexResult<Self>
fn try_from(value: &Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for Option<u16>
Fallible conversion from a Scalar into an Option<T>.
impl TryFrom<&Scalar> for Option<u16>
Fallible conversion from a Scalar into an Option<T>.
§Errors
Returns an error if the Scalar is not primitive, or if it is unable to convert the
Scalar into the target type.
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &Scalar) -> VortexResult<Self>
fn try_from(value: &Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for Option<u32>
Fallible conversion from a Scalar into an Option<T>.
impl TryFrom<&Scalar> for Option<u32>
Fallible conversion from a Scalar into an Option<T>.
§Errors
Returns an error if the Scalar is not primitive, or if it is unable to convert the
Scalar into the target type.
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &Scalar) -> VortexResult<Self>
fn try_from(value: &Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for Option<u64>
Fallible conversion from a Scalar into an Option<T>.
impl TryFrom<&Scalar> for Option<u64>
Fallible conversion from a Scalar into an Option<T>.
§Errors
Returns an error if the Scalar is not primitive, or if it is unable to convert the
Scalar into the target type.
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &Scalar) -> VortexResult<Self>
fn try_from(value: &Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for Option<u8>
Fallible conversion from a Scalar into an Option<T>.
impl TryFrom<&Scalar> for Option<u8>
Fallible conversion from a Scalar into an Option<T>.
§Errors
Returns an error if the Scalar is not primitive, or if it is unable to convert the
Scalar into the target type.
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &Scalar) -> VortexResult<Self>
fn try_from(value: &Scalar) -> VortexResult<Self>
Source§impl<'a> TryFrom<&'a Scalar> for PrimitiveScalar<'a>
impl<'a> TryFrom<&'a Scalar> for PrimitiveScalar<'a>
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &'a Scalar) -> VortexResult<Self>
fn try_from(value: &'a Scalar) -> VortexResult<Self>
Source§impl<'a> TryFrom<&'a Scalar> for StructScalar<'a>
impl<'a> TryFrom<&'a Scalar> for StructScalar<'a>
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &'a Scalar) -> VortexResult<Self>
fn try_from(value: &'a Scalar) -> VortexResult<Self>
Source§impl<'a> TryFrom<&'a Scalar> for Utf8Scalar<'a>
impl<'a> TryFrom<&'a Scalar> for Utf8Scalar<'a>
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &'a Scalar) -> VortexResult<Self>
fn try_from(value: &'a Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for bool
impl TryFrom<&Scalar> for bool
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &Scalar) -> VortexResult<Self>
fn try_from(value: &Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for f16
Fallible conversion from a Scalar into an T.
impl TryFrom<&Scalar> for f16
Fallible conversion from a Scalar into an T.
§Errors
Returns an error if unable to convert the scalar into the target type, or if the
Scalar itself is null.
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &Scalar) -> VortexResult<Self>
fn try_from(value: &Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for f32
Fallible conversion from a Scalar into an T.
impl TryFrom<&Scalar> for f32
Fallible conversion from a Scalar into an T.
§Errors
Returns an error if unable to convert the scalar into the target type, or if the
Scalar itself is null.
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &Scalar) -> VortexResult<Self>
fn try_from(value: &Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for f64
Fallible conversion from a Scalar into an T.
impl TryFrom<&Scalar> for f64
Fallible conversion from a Scalar into an T.
§Errors
Returns an error if unable to convert the scalar into the target type, or if the
Scalar itself is null.
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &Scalar) -> VortexResult<Self>
fn try_from(value: &Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for i16
Fallible conversion from a Scalar into an T.
impl TryFrom<&Scalar> for i16
Fallible conversion from a Scalar into an T.
§Errors
Returns an error if unable to convert the scalar into the target type, or if the
Scalar itself is null.
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &Scalar) -> VortexResult<Self>
fn try_from(value: &Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for i32
Fallible conversion from a Scalar into an T.
impl TryFrom<&Scalar> for i32
Fallible conversion from a Scalar into an T.
§Errors
Returns an error if unable to convert the scalar into the target type, or if the
Scalar itself is null.
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &Scalar) -> VortexResult<Self>
fn try_from(value: &Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for i64
Fallible conversion from a Scalar into an T.
impl TryFrom<&Scalar> for i64
Fallible conversion from a Scalar into an T.
§Errors
Returns an error if unable to convert the scalar into the target type, or if the
Scalar itself is null.
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &Scalar) -> VortexResult<Self>
fn try_from(value: &Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for i8
Fallible conversion from a Scalar into an T.
impl TryFrom<&Scalar> for i8
Fallible conversion from a Scalar into an T.
§Errors
Returns an error if unable to convert the scalar into the target type, or if the
Scalar itself is null.
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &Scalar) -> VortexResult<Self>
fn try_from(value: &Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for u16
Fallible conversion from a Scalar into an T.
impl TryFrom<&Scalar> for u16
Fallible conversion from a Scalar into an T.
§Errors
Returns an error if unable to convert the scalar into the target type, or if the
Scalar itself is null.
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &Scalar) -> VortexResult<Self>
fn try_from(value: &Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for u32
Fallible conversion from a Scalar into an T.
impl TryFrom<&Scalar> for u32
Fallible conversion from a Scalar into an T.
§Errors
Returns an error if unable to convert the scalar into the target type, or if the
Scalar itself is null.
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &Scalar) -> VortexResult<Self>
fn try_from(value: &Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for u64
Fallible conversion from a Scalar into an T.
impl TryFrom<&Scalar> for u64
Fallible conversion from a Scalar into an T.
§Errors
Returns an error if unable to convert the scalar into the target type, or if the
Scalar itself is null.
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &Scalar) -> VortexResult<Self>
fn try_from(value: &Scalar) -> VortexResult<Self>
Source§impl TryFrom<&Scalar> for u8
Fallible conversion from a Scalar into an T.
impl TryFrom<&Scalar> for u8
Fallible conversion from a Scalar into an T.
§Errors
Returns an error if unable to convert the scalar into the target type, or if the
Scalar itself is null.
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &Scalar) -> VortexResult<Self>
fn try_from(value: &Scalar) -> VortexResult<Self>
Source§impl TryFrom<Scalar> for ByteBuffer
impl TryFrom<Scalar> for ByteBuffer
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(scalar: Scalar) -> VortexResult<Self>
fn try_from(scalar: Scalar) -> VortexResult<Self>
Source§impl TryFrom<Scalar> for BufferString
impl TryFrom<Scalar> for BufferString
Source§impl TryFrom<Scalar> for DecimalValue
impl TryFrom<Scalar> for DecimalValue
Source§impl TryFrom<Scalar> for Option<ByteBuffer>
impl TryFrom<Scalar> for Option<ByteBuffer>
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(scalar: Scalar) -> VortexResult<Self>
fn try_from(scalar: Scalar) -> VortexResult<Self>
Source§impl TryFrom<Scalar> for Option<bool>
impl TryFrom<Scalar> for Option<bool>
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: Scalar) -> VortexResult<Self>
fn try_from(value: Scalar) -> VortexResult<Self>
Source§impl TryFrom<Scalar> for bool
impl TryFrom<Scalar> for bool
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: Scalar) -> VortexResult<Self>
fn try_from(value: Scalar) -> VortexResult<Self>
impl Eq for Scalar
Auto Trait Implementations§
impl !Freeze for Scalar
impl !RefUnwindSafe for Scalar
impl Send for Scalar
impl Sync for Scalar
impl Unpin for Scalar
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.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>
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>
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 moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> SessionVar for T
impl<T> SessionVar for T
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.