Skip to main content

ObjectValue

Enum ObjectValue 

Source
pub enum ObjectValue {
    List(Arc<[Scalar]>),
    Bytes(Arc<[u8]>),
    Host(HostValue),
}
Expand description

A pandas object cell that is not one of Scalar’s value kinds: a list, or a value of the host language (a Python datetime.date, dict, numpy dtype) that the core carries without reading (fvsao.33).

Variants§

§

List(Arc<[Scalar]>)

A list of values, compared and printed as Python’s list.

§

Bytes(Arc<[u8]>)

A bytes value, compared and printed as Python’s bytes (b'ab'): str.encode’s cells. The core reads it, so a bytes column needs no host (4qg5w.8).

§

Host(HostValue)

A host-language value, opaque to the core.

Implementations§

Source§

impl ObjectValue

Source

pub fn list(items: Vec<Scalar>) -> Self

A list cell of items.

Source

pub fn as_list(&self) -> Option<&[Scalar]>

The items of a list cell.

Source

pub fn bytes(data: Vec<u8>) -> Self

A bytes cell of data.

Source

pub fn as_bytes(&self) -> Option<&[u8]>

The bytes of a bytes cell.

Source

pub fn repr(&self) -> String

The cell as Python’s repr spells it ([1, 'a', None], b'ab').

Source

pub fn pprint(&self) -> String

The cell as pandas displays it in a repr (pandas’ pprint_thing): a list’s items unquoted ([1, a]), a host value as the host pprints it.

Source

pub fn type_name(&self) -> String

The cell’s Python type as Python’s errors name it (list, bytes, datetime.date).

Source

pub fn python_eq_scalar(&self, other: &Scalar) -> bool

Python’s == between this cell and a plain value: a host value asks the host (a dtype equals its name), a list or bytes never equals one (b'a' == 'a' is False).

Source

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

Python’s ordering of two cells, None where Python raises: host values by the host, lists item by item (a shorter prefix first), bytes by byte, and cells of different kinds unordered.

Source

pub fn total_cmp(&self, other: &Self) -> Ordering

A total order over cells, for sorted labels and ordered maps: Python’s ordering where it has one; otherwise a list before a host value, then the reprs, then identity - so two unequal cells are never Equal and equal cells always are.

Trait Implementations§

Source§

impl Clone for ObjectValue

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ObjectValue

Source§

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

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

impl<'de> Deserialize<'de> for ObjectValue

Source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for ObjectValue

Python’s str of the cell - what astype(str) and the writers produce: a list or bytes as its repr (['a', 1], b'ab'), a host value as its str.

Source§

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

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

impl Eq for ObjectValue

So a cell can key a hash map (groupby, unique, isin): lists by their items’ reprs, host values by the host’s hash (their repr when the host has none).

Source§

impl Hash for ObjectValue

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 Ord for ObjectValue

ObjectValue::total_cmp, so a cell can be an ordered label.

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for ObjectValue

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialOrd for ObjectValue

Source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 ObjectValue

A list cell serializes as the sequence of its items, a bytes cell as {"bytes": [..]}; a host value has no serialized form.

Source§

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

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

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

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.