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>
impl<'a, const CONST: bool, V: Value<CONST>> ValueReference<'a, CONST, V>
Sourcepub fn is_variable(&self) -> bool
pub fn is_variable(&self) -> bool
Returns true if this is a ValueReference::Variable
, otherwise false
Sourcepub fn as_variable_mut(&mut self) -> Option<&mut &'a V::Variable>
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
Sourcepub fn as_variable(&self) -> Option<&&'a V::Variable>
pub fn as_variable(&self) -> Option<&&'a V::Variable>
Optionally returns references to the inner fields if this is a ValueReference::Variable
, otherwise None
Sourcepub fn into_variable(self) -> Result<&'a V::Variable, Self>
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
Sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Returns true if this is a ValueReference::Integer
, otherwise false
Sourcepub fn as_integer_mut(&mut self) -> Option<&mut i32>
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
Sourcepub fn as_integer(&self) -> Option<&i32>
pub fn as_integer(&self) -> Option<&i32>
Optionally returns references to the inner fields if this is a ValueReference::Integer
, otherwise None
Sourcepub fn into_integer(self) -> Result<i32, Self>
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
Sourcepub fn is_float(&self) -> bool
pub fn is_float(&self) -> bool
Returns true if this is a ValueReference::Float
, otherwise false
Sourcepub fn as_float_mut(&mut self) -> Option<&mut f64>
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
Sourcepub fn as_float(&self) -> Option<&f64>
pub fn as_float(&self) -> Option<&f64>
Optionally returns references to the inner fields if this is a ValueReference::Float
, otherwise None
Sourcepub fn into_float(self) -> Result<f64, Self>
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
Sourcepub fn is_string(&self) -> bool
pub fn is_string(&self) -> bool
Returns true if this is a ValueReference::String
, otherwise false
Sourcepub fn as_string_mut(&mut self) -> Option<&mut &'a str>
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
Sourcepub fn as_string(&self) -> Option<&&'a str>
pub fn as_string(&self) -> Option<&&'a str>
Optionally returns references to the inner fields if this is a ValueReference::String
, otherwise None
Sourcepub fn into_string(self) -> Result<&'a str, Self>
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
Sourcepub fn is_boolean(&self) -> bool
pub fn is_boolean(&self) -> bool
Returns true if this is a ValueReference::Boolean
, otherwise false
Sourcepub fn as_boolean_mut(&mut self) -> Option<&mut bool>
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
Sourcepub fn as_boolean(&self) -> Option<&bool>
pub fn as_boolean(&self) -> Option<&bool>
Optionally returns references to the inner fields if this is a ValueReference::Boolean
, otherwise None
Sourcepub fn into_boolean(self) -> Result<bool, Self>
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
Sourcepub fn as_enum_mut(&mut self) -> Option<&mut &'a str>
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
Sourcepub fn as_enum(&self) -> Option<&&'a str>
pub fn as_enum(&self) -> Option<&&'a str>
Optionally returns references to the inner fields if this is a ValueReference::Enum
, otherwise None
Sourcepub fn into_enum(self) -> Result<&'a str, Self>
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
Sourcepub fn as_list_mut(&mut self) -> Option<&mut &'a V::List>
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
Sourcepub fn as_list(&self) -> Option<&&'a V::List>
pub fn as_list(&self) -> Option<&&'a V::List>
Optionally returns references to the inner fields if this is a ValueReference::List
, otherwise None
Sourcepub fn into_list(self) -> Result<&'a V::List, Self>
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
Sourcepub fn is_object(&self) -> bool
pub fn is_object(&self) -> bool
Returns true if this is a ValueReference::Object
, otherwise false
Sourcepub fn as_object_mut(&mut self) -> Option<&mut &'a V::Object>
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
Sourcepub fn as_object(&self) -> Option<&&'a V::Object>
pub fn as_object(&self) -> Option<&&'a V::Object>
Optionally returns references to the inner fields if this is a ValueReference::Object
, otherwise None
Sourcepub fn into_object(self) -> Result<&'a V::Object, Self>
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
Trait Implementations§
Source§impl<'a, '_derivative_strum, const CONST: bool, V: Value<CONST>> From<&'_derivative_strum ValueReference<'a, CONST, V>> for &'static str
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
fn from(x: &'_derivative_strum ValueReference<'a, CONST, V>) -> &'static str
Source§impl<'a, const CONST: bool, V: Value<CONST>> From<ValueReference<'a, CONST, V>> for &'static str
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
fn from(x: ValueReference<'a, CONST, V>) -> &'static str
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>
impl<'a, const CONST: bool, V> Sync for ValueReference<'a, CONST, V>
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> 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,
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