Skip to main content

DatumValue

Struct DatumValue 

Source
pub struct DatumValue {
    pub datum: Datum<WithEncoding<ByteString>>,
    pub format: ValueFormat,
    pub show: Option<Show>,
    pub variable: Option<String>,
    pub value_label: Option<String>,
}
Expand description

A datum and how to display it.

Fields§

§datum: Datum<WithEncoding<ByteString>>

The datum.

§format: ValueFormat

The display format.

§show: Option<Show>

Whether to show value or value_label or both.

If this is unset, then a higher-level default is used.

§variable: Option<String>

The name of the variable that value came from, if any.

§value_label: Option<String>

The value label associated with value, if any.

Implementations§

Source§

impl DatumValue

Source

pub fn new<B>(datum: &Datum<B>) -> Self
where B: EncodedString,

Constructs a new DatumValue for datum.

Source

pub fn new_number(number: Option<f64>) -> Self

Constructs a new DatumValue for number.

Source

pub fn with_format(self, format: ValueFormat) -> Self

Returns this DatumValue with the given format.

Source

pub fn display<'a>( &self, display: &DisplayValue<'a>, f: &mut Formatter<'_>, ) -> Result

Writes this value to f using the settings in display.

Source

pub fn decimal(&self) -> Decimal

Returns the decimal point used in the formatted value, if any.

Source

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

Serializes this value to serializer in the “bare” manner described for BareValue.

Trait Implementations§

Source§

impl Clone for DatumValue

Source§

fn clone(&self) -> DatumValue

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 DatumValue

Source§

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

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

impl PartialEq for DatumValue

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Serialize for DatumValue

Source§

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

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

impl StructuralPartialEq for DatumValue

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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

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