#[non_exhaustive]pub enum OwnedValue {
Empty,
Bool(bool),
Int(i64),
Float(f64),
Decimal(Decimal),
Text(Arc<str>),
Timestamp(DateTime<Utc>),
Custom(Arc<dyn GridValue>),
}Expand description
An owned cell value: a group key kept across snapshots, an aggregate result.
Two values are equal exactly when CellValue::cmp_total calls them
equal, and equal values hash alike: Int(1) == Float(1.0), while -0.0
and 0.0 are two values and a NaN equals only itself, bit for bit. A
Decimal equals the numbers of its value: Decimal(1.00) == Int(1),
Decimal(0.5) == Float(0.5).
Serialized as JSON-like data: Empty as null, Bool as a boolean,
Int as an integer, Float as a number with a fraction or an exponent
(1.0, never 1, so it reads back as a Float), Text as a string,
Decimal as {"decimal": "12.30"}, text that keeps the scale,
Timestamp as {"timestamp": "2026-11-04T12:34:56Z"}, RFC 3339 in UTC
with the fraction it has. A NaN, an infinity or a timestamp outside the
years 0 to 9999 is not serialized: writing one fails. A string reads back
as Text, never as a timestamp.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Empty
No value.
Bool(bool)
A boolean.
Int(i64)
An integer.
Float(f64)
A floating point number.
Decimal(Decimal)
An exact decimal number with its scale. Needs the decimal feature.
Text(Arc<str>)
Text.
Timestamp(DateTime<Utc>)
A point in time.
Custom(Arc<dyn GridValue>)
A value of the application’s own type, shared: what
GridValue::to_owned_value returns to keep its order and text.
Two are equal when GridValue::cmp_value says so; it hashes by
its type. Serialized as its GridValue::export_value, else as
its text, and read back as that: a restored layout’s group of a
custom key does not find the group again.
Implementations§
Source§impl OwnedValue
impl OwnedValue
Sourcepub fn custom(value: impl GridValue) -> Self
pub fn custom(value: impl GridValue) -> Self
A value of the application’s own type, kept as itself: for
GridValue::to_owned_value, usually OwnedValue::custom(self.clone()).
Allocates once.
Sourcepub fn from_cell(value: CellValue<'_>) -> Self
pub fn from_cell(value: CellValue<'_>) -> Self
Copies a borrowed value; allocates only for Text and Icon, and
for Custom as its GridValue::to_owned_value does. An Icon
becomes the Text of its text: the icon is the cell’s look, its
text the value.
Sourcepub fn as_cell(&self) -> CellValue<'_>
pub fn as_cell(&self) -> CellValue<'_>
Borrows the value back, to show it as a cell does or to compare it.
Sourcepub fn cmp_total(&self, other: &Self) -> Ordering
pub fn cmp_total(&self, other: &Self) -> Ordering
The order of CellValue::cmp_total.
Trait Implementations§
Source§impl Clone for OwnedValue
impl Clone for OwnedValue
Source§fn clone(&self) -> OwnedValue
fn clone(&self) -> OwnedValue
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OwnedValue
impl Debug for OwnedValue
Source§impl<'de> Deserialize<'de> for OwnedValue
impl<'de> Deserialize<'de> for OwnedValue
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl Hash for OwnedValue
impl Hash for OwnedValue
Source§impl PartialEq for OwnedValue
impl PartialEq for OwnedValue
Source§impl Serialize for OwnedValue
impl Serialize for OwnedValue
impl Eq for OwnedValue
Auto Trait Implementations§
impl Freeze for OwnedValue
impl !RefUnwindSafe for OwnedValue
impl Send for OwnedValue
impl Sync for OwnedValue
impl Unpin for OwnedValue
impl UnsafeUnpin for OwnedValue
impl !UnwindSafe for OwnedValue
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more