Enum polars_core::datatypes::AnyValue

source ·
pub enum AnyValue<'a> {
Show 22 variants Null, Boolean(bool), String(&'a str), UInt8(u8), UInt16(u16), UInt32(u32), UInt64(u64), Int8(i8), Int16(i16), Int32(i32), Int64(i64), Float32(f32), Float64(f64), Categorical(u32, &'a RevMapping, SyncPtr<Utf8ViewArray>), Enum(u32, &'a RevMapping, SyncPtr<Utf8ViewArray>), List(Series), Object(&'a dyn PolarsObjectSafe), ObjectOwned(OwnedObject), StringOwned(String), Binary(&'a [u8]), BinaryOwned(Vec<u8>), Decimal(i128, usize),
}

Variants§

§

Null

§

Boolean(bool)

A binary true or false.

§

String(&'a str)

A UTF8 encoded string type.

§

UInt8(u8)

An unsigned 8-bit integer number.

§

UInt16(u16)

An unsigned 16-bit integer number.

§

UInt32(u32)

An unsigned 32-bit integer number.

§

UInt64(u64)

An unsigned 64-bit integer number.

§

Int8(i8)

An 8-bit integer number.

§

Int16(i16)

A 16-bit integer number.

§

Int32(i32)

A 32-bit integer number.

§

Int64(i64)

A 64-bit integer number.

§

Float32(f32)

A 32-bit floating point number.

§

Float64(f64)

A 64-bit floating point number.

§

Categorical(u32, &'a RevMapping, SyncPtr<Utf8ViewArray>)

Available on crate feature dtype-categorical only.
§

Enum(u32, &'a RevMapping, SyncPtr<Utf8ViewArray>)

Available on crate feature dtype-categorical only.
§

List(Series)

Nested type, contains arrays that are filled with one of the datatypes.

§

Object(&'a dyn PolarsObjectSafe)

Available on crate feature object only.

Can be used to fmt and implements Any, so can be downcasted to the proper value type.

§

ObjectOwned(OwnedObject)

Available on crate feature object only.
§

StringOwned(String)

An UTF8 encoded string type.

§

Binary(&'a [u8])

§

BinaryOwned(Vec<u8>)

§

Decimal(i128, usize)

Available on crate feature dtype-decimal only.

A 128-bit fixed point decimal number.

Implementations§

source§

impl AnyValue<'static>

source

pub fn zero(dtype: &DataType) -> Self

source§

impl<'a> AnyValue<'a>

source

pub fn dtype(&self) -> DataType

Get the matching DataType for this AnyValue`.

Note: For Categorical and Enum values, the exact mapping information is not preserved in the result for performance reasons.

source

pub fn try_extract<T: NumCast>(&self) -> PolarsResult<T>

source

pub fn is_boolean(&self) -> bool

source

pub fn is_numeric(&self) -> bool

source

pub fn is_float(&self) -> bool

source

pub fn is_integer(&self) -> bool

source

pub fn is_signed_integer(&self) -> bool

source

pub fn is_unsigned_integer(&self) -> bool

source

pub fn is_null(&self) -> bool

source

pub fn is_nested_null(&self) -> bool

source

pub fn strict_cast(&self, dtype: &'a DataType) -> Option<AnyValue<'a>>

Cast AnyValue to the provided data type and return a new AnyValue with type dtype, if possible.

source

pub fn try_strict_cast(&self, dtype: &'a DataType) -> PolarsResult<AnyValue<'a>>

Cast AnyValue to the provided data type and return a new AnyValue with type dtype, if possible.

source

pub fn cast(&self, dtype: &'a DataType) -> AnyValue<'a>

source§

impl AnyValue<'_>

source

pub fn hash_impl<H: Hasher>(&self, state: &mut H, cheap: bool)

source§

impl<'a> AnyValue<'a>

source

pub fn add(&self, rhs: &AnyValue<'_>) -> AnyValue<'static>

source

pub fn as_borrowed(&self) -> AnyValue<'_>

source

pub fn into_static(self) -> PolarsResult<AnyValue<'static>>

Try to coerce to an AnyValue with static lifetime. This can be done if it does not borrow any values.

source

pub fn get_str(&self) -> Option<&str>

Get a reference to the &str contained within AnyValue.

source§

impl AnyValue<'_>

source

pub fn eq_missing(&self, other: &Self, null_equal: bool) -> bool

Trait Implementations§

source§

impl<'a> Clone for AnyValue<'a>

source§

fn clone(&self) -> AnyValue<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for AnyValue<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Default for AnyValue<'a>

source§

fn default() -> AnyValue<'a>

Returns the “default value” for a type. Read more
source§

impl Display for AnyValue<'_>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> From<&'a [u8]> for AnyValue<'a>

source§

fn from(value: &'a [u8]) -> Self

Converts to this type from the input type.
source§

impl From<&AnyValue<'_>> for NaiveDateTime

Available on crate features temporal or dtype-datetime or dtype-date only.
source§

fn from(v: &AnyValue<'_>) -> Self

Converts to this type from the input type.
source§

impl From<&AnyValue<'_>> for NaiveTime

Available on crate features temporal or dtype-datetime or dtype-date only.
source§

fn from(v: &AnyValue<'_>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&AnyValue<'a>> for DataType

source§

fn from(value: &AnyValue<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&AnyValue<'a>> for Field

Available on crate features rows or object only.
source§

fn from(val: &AnyValue<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a str> for AnyValue<'a>

source§

fn from(value: &'a str) -> Self

Converts to this type from the input type.
source§

impl From<AnyValue<'_>> for DataType

source§

fn from(value: AnyValue<'_>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<AnyValue<'a>> for Option<i64>

source§

fn from(val: AnyValue<'a>) -> Self

Converts to this type from the input type.
source§

impl<K: NumericNative> From<K> for AnyValue<'static>

source§

fn from(value: K) -> Self

Converts to this type from the input type.
source§

impl<'a, T> From<Option<T>> for AnyValue<'a>
where T: Into<AnyValue<'a>>,

source§

fn from(a: Option<T>) -> Self

Converts to this type from the input type.
source§

impl From<bool> for AnyValue<'static>

source§

fn from(value: bool) -> Self

Converts to this type from the input type.
source§

impl<'a> Hash for AnyValue<'a>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for AnyValue<'_>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for AnyValue<'_>

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

Only implemented for the same types and physical types!

1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl TotalEq for AnyValue<'_>

source§

fn tot_eq(&self, other: &Self) -> bool

source§

fn tot_ne(&self, other: &Self) -> bool

source§

impl<'a> Eq for AnyValue<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for AnyValue<'a>

§

impl<'a> !RefUnwindSafe for AnyValue<'a>

§

impl<'a> Send for AnyValue<'a>

§

impl<'a> Sync for AnyValue<'a>

§

impl<'a> Unpin for AnyValue<'a>

§

impl<'a> !UnwindSafe for AnyValue<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V