Value

Struct Value 

Source
pub struct Value<T>(/* private fields */);
Expand description

Value that a property can assume.

This can either be a literal value, or an invocation of an instrinsic function.

Implementations§

Source§

impl<T> Value<T>

Source

pub fn new(value: T) -> Value<T>

Create a new value.

Source

pub fn reference<S: Into<String>>(id: S) -> Value<T>

Create a new value backed by a reference.

Source

pub fn expression(expr: Expr) -> Value<T>

Create a new value backed by an expression.

Source

pub fn as_value(&self) -> Option<&T>

If the value contains a literal value, return Some.

Return None otherwise.

Source

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

If the value is a reference, return Some.

Return None otherwise.

Source

pub fn as_expression(&self) -> Option<&Expr>

If the value is an expression, return Some.

Return None otherwise.

Trait Implementations§

Source§

impl<T: Debug> Debug for Value<T>

Source§

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

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

impl<T: Default> Default for Value<T>

Source§

fn default() -> Value<T>

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

impl<'de, T: DeserializeValue> Deserialize<'de> for Value<T>

Source§

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

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

impl<T> From<T> for Value<T>

Source§

fn from(value: T) -> Value<T>

Converts to this type from the input type.
Source§

impl<T> FromIterator<Value<T>> for ValueList<T>

Source§

fn from_iter<I>(iter: I) -> ValueList<T>
where I: IntoIterator<Item = Value<T>>,

Creates a value from an iterator. Read more
Source§

impl<T: SerializeValue> Serialize for Value<T>

Source§

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

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<T> Freeze for Value<T>

§

impl<T> RefUnwindSafe for Value<T>
where T: RefUnwindSafe,

§

impl<T> Send for Value<T>
where T: Send,

§

impl<T> Sync for Value<T>
where T: Sync,

§

impl<T> Unpin for Value<T>

§

impl<T> UnwindSafe for Value<T>
where T: UnwindSafe,

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> From<!> for T

Source§

fn from(t: !) -> T

Converts to this type from the input type.
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, 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.
Source§

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