Enum ValueReference

Source
pub enum ValueReference<'a, const CONST: bool, V: Value<CONST>> {
    Variable(&'a V::Variable),
    Integer(i32),
    Float(f64),
    String(&'a str),
    Boolean(bool),
    Null,
    Enum(&'a str),
    List(&'a V::List),
    Object(&'a V::Object),
}

Variants§

§

Variable(&'a V::Variable)

§

Integer(i32)

§

Float(f64)

§

String(&'a str)

§

Boolean(bool)

§

Null

§

Enum(&'a str)

§

List(&'a V::List)

§

Object(&'a V::Object)

Implementations§

Source§

impl<'a, const CONST: bool, V: Value<CONST>> ValueReference<'a, CONST, V>

Source

pub fn is_variable(&self) -> bool

Returns true if this is a ValueReference::Variable, otherwise false

Source

pub fn as_variable_mut(&mut self) -> Option<&mut &'a V::Variable>

Optionally returns mutable references to the inner fields if this is a ValueReference::Variable, otherwise None

Source

pub fn as_variable(&self) -> Option<&&'a V::Variable>

Optionally returns references to the inner fields if this is a ValueReference::Variable, otherwise None

Source

pub fn into_variable(self) -> Result<&'a V::Variable, Self>

Returns the inner fields if this is a ValueReference::Variable, otherwise returns back the enum in the Err case of the result

Source

pub fn is_integer(&self) -> bool

Returns true if this is a ValueReference::Integer, otherwise false

Source

pub fn as_integer_mut(&mut self) -> Option<&mut i32>

Optionally returns mutable references to the inner fields if this is a ValueReference::Integer, otherwise None

Source

pub fn as_integer(&self) -> Option<&i32>

Optionally returns references to the inner fields if this is a ValueReference::Integer, otherwise None

Source

pub fn into_integer(self) -> Result<i32, Self>

Returns the inner fields if this is a ValueReference::Integer, otherwise returns back the enum in the Err case of the result

Source

pub fn is_float(&self) -> bool

Returns true if this is a ValueReference::Float, otherwise false

Source

pub fn as_float_mut(&mut self) -> Option<&mut f64>

Optionally returns mutable references to the inner fields if this is a ValueReference::Float, otherwise None

Source

pub fn as_float(&self) -> Option<&f64>

Optionally returns references to the inner fields if this is a ValueReference::Float, otherwise None

Source

pub fn into_float(self) -> Result<f64, Self>

Returns the inner fields if this is a ValueReference::Float, otherwise returns back the enum in the Err case of the result

Source

pub fn is_string(&self) -> bool

Returns true if this is a ValueReference::String, otherwise false

Source

pub fn as_string_mut(&mut self) -> Option<&mut &'a str>

Optionally returns mutable references to the inner fields if this is a ValueReference::String, otherwise None

Source

pub fn as_string(&self) -> Option<&&'a str>

Optionally returns references to the inner fields if this is a ValueReference::String, otherwise None

Source

pub fn into_string(self) -> Result<&'a str, Self>

Returns the inner fields if this is a ValueReference::String, otherwise returns back the enum in the Err case of the result

Source

pub fn is_boolean(&self) -> bool

Returns true if this is a ValueReference::Boolean, otherwise false

Source

pub fn as_boolean_mut(&mut self) -> Option<&mut bool>

Optionally returns mutable references to the inner fields if this is a ValueReference::Boolean, otherwise None

Source

pub fn as_boolean(&self) -> Option<&bool>

Optionally returns references to the inner fields if this is a ValueReference::Boolean, otherwise None

Source

pub fn into_boolean(self) -> Result<bool, Self>

Returns the inner fields if this is a ValueReference::Boolean, otherwise returns back the enum in the Err case of the result

Source

pub fn is_null(&self) -> bool

Returns true if this is a ValueReference::Null, otherwise false

Source

pub fn is_enum(&self) -> bool

Returns true if this is a ValueReference::Enum, otherwise false

Source

pub fn as_enum_mut(&mut self) -> Option<&mut &'a str>

Optionally returns mutable references to the inner fields if this is a ValueReference::Enum, otherwise None

Source

pub fn as_enum(&self) -> Option<&&'a str>

Optionally returns references to the inner fields if this is a ValueReference::Enum, otherwise None

Source

pub fn into_enum(self) -> Result<&'a str, Self>

Returns the inner fields if this is a ValueReference::Enum, otherwise returns back the enum in the Err case of the result

Source

pub fn is_list(&self) -> bool

Returns true if this is a ValueReference::List, otherwise false

Source

pub fn as_list_mut(&mut self) -> Option<&mut &'a V::List>

Optionally returns mutable references to the inner fields if this is a ValueReference::List, otherwise None

Source

pub fn as_list(&self) -> Option<&&'a V::List>

Optionally returns references to the inner fields if this is a ValueReference::List, otherwise None

Source

pub fn into_list(self) -> Result<&'a V::List, Self>

Returns the inner fields if this is a ValueReference::List, otherwise returns back the enum in the Err case of the result

Source

pub fn is_object(&self) -> bool

Returns true if this is a ValueReference::Object, otherwise false

Source

pub fn as_object_mut(&mut self) -> Option<&mut &'a V::Object>

Optionally returns mutable references to the inner fields if this is a ValueReference::Object, otherwise None

Source

pub fn as_object(&self) -> Option<&&'a V::Object>

Optionally returns references to the inner fields if this is a ValueReference::Object, otherwise None

Source

pub fn into_object(self) -> Result<&'a V::Object, Self>

Returns the inner fields if this is a ValueReference::Object, otherwise returns back the enum in the Err case of the result

Source§

impl<const CONST: bool, V: Value<CONST>> ValueReference<'_, CONST, V>

Source

pub fn variant(&self) -> &'static str

Trait Implementations§

Source§

impl<const CONST: bool, V: Value<CONST>> Clone for ValueReference<'_, CONST, V>

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a, const CONST: bool, V: Debug + Value<CONST>> Debug for ValueReference<'a, CONST, V>
where V::Variable: Debug, V::List: Debug, V::Object: Debug,

Source§

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

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

impl<'a, '_derivative_strum, const CONST: bool, V: Value<CONST>> From<&'_derivative_strum ValueReference<'a, CONST, V>> for &'static str

Source§

fn from(x: &'_derivative_strum ValueReference<'a, CONST, V>) -> &'static str

Converts to this type from the input type.
Source§

impl<'a, const CONST: bool, V: Value<CONST>> From<ValueReference<'a, CONST, V>> for &'static str

Source§

fn from(x: ValueReference<'a, CONST, V>) -> &'static str

Converts to this type from the input type.
Source§

impl<const CONST: bool, V: Value<CONST>> PartialEq for ValueReference<'_, CONST, V>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const CONST: bool, V: Value<CONST>> Copy for ValueReference<'_, CONST, V>

Auto Trait Implementations§

§

impl<'a, const CONST: bool, V> Freeze for ValueReference<'a, CONST, V>

§

impl<'a, const CONST: bool, V> RefUnwindSafe for ValueReference<'a, CONST, V>
where <V as Value<CONST>>::Variable: RefUnwindSafe, <V as Value<CONST>>::List: RefUnwindSafe, <V as Value<CONST>>::Object: RefUnwindSafe,

§

impl<'a, const CONST: bool, V> Send for ValueReference<'a, CONST, V>
where <V as Value<CONST>>::Variable: Sync, <V as Value<CONST>>::List: Sync, <V as Value<CONST>>::Object: Sync,

§

impl<'a, const CONST: bool, V> Sync for ValueReference<'a, CONST, V>
where <V as Value<CONST>>::Variable: Sync, <V as Value<CONST>>::List: Sync, <V as Value<CONST>>::Object: Sync,

§

impl<'a, const CONST: bool, V> Unpin for ValueReference<'a, CONST, V>

§

impl<'a, const CONST: bool, V> UnwindSafe for ValueReference<'a, CONST, V>
where <V as Value<CONST>>::Variable: RefUnwindSafe, <V as Value<CONST>>::List: RefUnwindSafe, <V as Value<CONST>>::Object: RefUnwindSafe,

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