Enum polars::datatypes::AnyValue

source ·
pub enum AnyValue<'a> {
Show 29 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), Date(i32), Datetime(i64, TimeUnit, &'a Option<String>), Duration(i64, TimeUnit), Time(i64), Categorical(u32, &'a RevMapping, SyncPtr<BinaryViewArrayGeneric<str>>), Enum(u32, &'a RevMapping, SyncPtr<BinaryViewArrayGeneric<str>>), List(Series), Array(Series, usize), Object(&'a (dyn PolarsObjectSafe + 'static)), ObjectOwned(OwnedObject), Struct(usize, &'a StructArray, &'a [Field]), StructOwned(Box<(Vec<AnyValue<'a>>, Vec<Field>)>), StringOwned(SmartString<LazyCompact>), 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.

§

Date(i32)

Available on crate feature dtype-date only.

A 32-bit date representing the elapsed time since UNIX epoch (1970-01-01) in days (32 bits).

§

Datetime(i64, TimeUnit, &'a Option<String>)

Available on crate feature dtype-datetime only.

A 64-bit date representing the elapsed time since UNIX epoch (1970-01-01) in nanoseconds (64 bits).

§

Duration(i64, TimeUnit)

Available on crate feature dtype-duration only.
§

Time(i64)

Available on crate feature dtype-time only.

A 64-bit time representing the elapsed time since midnight in nanoseconds

§

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

Available on crate feature dtype-categorical only.
§

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

Available on crate feature dtype-categorical only.
§

List(Series)

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

§

Array(Series, usize)

Available on crate feature dtype-array only.
§

Object(&'a (dyn PolarsObjectSafe + 'static))

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.
§

Struct(usize, &'a StructArray, &'a [Field])

Available on crate feature dtype-struct only.
§

StructOwned(Box<(Vec<AnyValue<'a>>, Vec<Field>)>)

Available on crate feature dtype-struct only.
§

StringOwned(SmartString<LazyCompact>)

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<'a> AnyValue<'a>

source

pub fn _iter_struct_av(&self) -> impl Iterator<Item = AnyValue<'_>>

Available on crate feature dtype-struct only.
source

pub fn _materialize_struct_av(&'a self, buf: &mut Vec<AnyValue<'a>>)

Available on crate feature dtype-struct only.
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>(&self) -> Result<T, PolarsError>
where T: NumCast,

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 ) -> Result<AnyValue<'a>, PolarsError>

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>(&self, state: &mut H, cheap: bool)
where H: Hasher,

source§

impl<'a> AnyValue<'a>

source

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

source

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

source

pub fn into_static(self) -> Result<AnyValue<'static>, PolarsError>

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: &AnyValue<'_>, 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<(), Error>

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<(), Error>

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

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

source§

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

Converts to this type from the input type.
source§

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

source§

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

Converts to this type from the input type.
source§

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

source§

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

Converts to this type from the input type.
source§

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

source§

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

Converts to this type from the input type.
source§

impl From<AnyValue<'_>> for DataType

source§

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

Converts to this type from the input type.
source§

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

source§

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

Converts to this type from the input type.
source§

impl<K> From<K> for AnyValue<'_>
where K: NumericNative,

source§

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

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>) -> AnyValue<'a>

Converts to this type from the input type.
source§

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

source§

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

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: &AnyValue<'_>) -> 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: &AnyValue<'_>) -> 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 TryFrom<AnyValue<'_>> for LiteralValue

§

type Error = PolarsError

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

fn try_from(value: AnyValue<'_>) -> Result<LiteralValue, PolarsError>

Performs the conversion.
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 ()

source§

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

source§

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

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

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

source§

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

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

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

Initializes a with the given initializer. Read more
source§

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

Dereferences the given pointer. Read more
source§

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

Mutably dereferences the given pointer. Read more
source§

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

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

source§

fn vzip(self) -> V