polars::datatypes

Enum AnyValue

Source
pub enum AnyValue<'a> {
Show 32 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, Option<&'a PlSmallStr>), DatetimeOwned(i64, TimeUnit, Option<Arc<PlSmallStr>>), Duration(i64, TimeUnit), Time(i64), Categorical(u32, &'a RevMapping, SyncPtr<BinaryViewArrayGeneric<str>>), CategoricalOwned(u32, Arc<RevMapping>, SyncPtr<BinaryViewArrayGeneric<str>>), Enum(u32, &'a RevMapping, SyncPtr<BinaryViewArrayGeneric<str>>), EnumOwned(u32, Arc<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(PlSmallStr), 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, Option<&'a PlSmallStr>)

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

§

DatetimeOwned(i64, TimeUnit, Option<Arc<PlSmallStr>>)

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.

A 64-bit integer representing difference between date-times in TimeUnit

§

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

CategoricalOwned(u32, Arc<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.
§

EnumOwned(u32, Arc<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(PlSmallStr)

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 with a scale.

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

Source

pub fn zero_sum(dtype: &DataType) -> AnyValue<'static>

Source

pub fn can_have_dtype(&self, dtype: &DataType) -> bool

Can the AnyValue exist as having dtype as its DataType.

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_nan(&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, ) -> 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

pub fn idx(&self) -> u32

Source

pub fn str_value(&self) -> Cow<'a, str>

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<'static>

Source

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

Source

pub fn into_static(self) -> 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: &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<'a> Deserialize<'a> for AnyValue<'static>

Available on crate feature serde only.
Source§

fn deserialize<D>( deserializer: D, ) -> Result<AnyValue<'static>, <D as Deserializer<'a>>::Error>
where D: Deserializer<'a>,

Deserialize this value from the given Serde deserializer. 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<'a> From<&'a [u8]> for AnyValue<'a>

Source§

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

Converts to this type from the input type.
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<'a> From<&'a str> for AnyValue<'a>

Source§

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

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

impl From<AnyValue<'_>> for LiteralValue

§

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

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<'static>
where K: NumericNative,

Source§

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

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 From<bool> for AnyValue<'static>

Source§

fn from(value: bool) -> AnyValue<'static>

Converts to this type from the input type.
Source§

impl Hash for AnyValue<'_>

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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

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

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

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for AnyValue<'_>

Available on crate feature serde only.
Source§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TotalEq for AnyValue<'_>

Source§

fn tot_eq(&self, other: &AnyValue<'_>) -> bool

Source§

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

Source§

impl Eq for AnyValue<'_>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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

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

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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
§

impl<T> ToCompactString for T
where T: Display,

§

fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>

Fallible version of [ToCompactString::to_compact_string()] Read more
§

fn to_compact_string(&self) -> CompactString

Converts the given value to a [CompactString]. Read more
Source§

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

Source§

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>,

Source§

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>,

Source§

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

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T