Skip to main content

ValueInner

Enum ValueInner 

Source
pub enum ValueInner {
    Datum(DatumValue),
    Variable(VariableValue),
    Text(TextValue),
    Markup(Markup),
    Template(TemplateValue),
    Empty,
}
Expand description

Possible content for a Value.

Variants§

§

Datum(DatumValue)

A Datum value.

Tuple Fields

§0: DatumValue

The datum.

§

Variable(VariableValue)

A variable name.

Tuple Fields

§0: VariableValue

The variable.

§

Text(TextValue)

Plain text.

Tuple Fields

§0: TextValue

The text.

§

Markup(Markup)

Rich text.

Tuple Fields

§0: Markup

The rich text.

§

Template(TemplateValue)

A template with substitutions.

Tuple Fields

§0: TemplateValue

The template.

§

Empty

An empty value.

Implementations§

Source§

impl ValueInner

Source

pub const fn is_empty(&self) -> bool

Returns true if this is a ValueInner::Empty.

Source

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

Returns this value with its display format set to format, if it is a DatumValue.

Source

pub fn datum(&self) -> Option<&Datum<WithEncoding<ByteString>>>

Returns the Datum inside this value, if it is a DatumValue.

Source

pub fn label(&self) -> Option<&str>

Returns the value label or variable label inside this value, if it has one.

Source

pub fn as_datum_value(&self) -> Option<&DatumValue>

Returns the DatumValue inside this value, if it is ValueInner::Datum.

Source

pub fn as_datum_value_mut(&mut self) -> Option<&mut DatumValue>

Returns the DatumValue inside this value, mutably, if it is ValueInner::Datum.

Source

pub fn as_variable_value(&self) -> Option<&VariableValue>

Returns the VariableValue inside this value, if it is ValueInner::Variable.

Source

pub fn as_variable_value_mut(&mut self) -> Option<&mut VariableValue>

Returns the VariableValue inside this value, mutably, if it is ValueInner::Variable.

Source

pub fn display(&self, options: impl Into<ValueOptions>) -> DisplayValue<'_>

Returns an object that will format this value. Settings on options control whether variable and value labels are included.

Source

pub fn new_user_text(s: impl Into<String>) -> Self

Constructs a new text ValueInner from s, which should have been provided by the user.

Trait Implementations§

Source§

impl Clone for ValueInner

Source§

fn clone(&self) -> ValueInner

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 ValueInner

Source§

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

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

impl Default for ValueInner

Source§

fn default() -> ValueInner

Returns the “default value” for a type. Read more
Source§

impl PartialEq for ValueInner

Source§

fn eq(&self, other: &ValueInner) -> 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 ValueInner

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 ValueInner

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.