pub enum CompoundValue {
Pair(Pair),
Array(Array),
Map(Map),
Object(Object),
Struct(Struct),
}
Expand description
Represents a compound value.
Compound values are cheap to clone.
Variants§
Pair(Pair)
The value is a Pair
of values.
Array(Array)
The value is an Array
of values.
Map(Map)
The value is a Map
of values.
Object(Object)
The value is an Object
.
Struct(Struct)
The value is a struct.
Implementations§
Source§impl CompoundValue
impl CompoundValue
Sourcepub fn as_pair(&self) -> Option<&Pair>
pub fn as_pair(&self) -> Option<&Pair>
Gets the value as a Pair
.
Returns None
if the value is not a Pair
.
Sourcepub fn unwrap_pair(self) -> Pair
pub fn unwrap_pair(self) -> Pair
Sourcepub fn as_array(&self) -> Option<&Array>
pub fn as_array(&self) -> Option<&Array>
Gets the value as an Array
.
Returns None
if the value is not an Array
.
Sourcepub fn unwrap_array(self) -> Array
pub fn unwrap_array(self) -> Array
Sourcepub fn as_map(&self) -> Option<&Map>
pub fn as_map(&self) -> Option<&Map>
Gets the value as a Map
.
Returns None
if the value is not a Map
.
Sourcepub fn unwrap_map(self) -> Map
pub fn unwrap_map(self) -> Map
Sourcepub fn as_object(&self) -> Option<&Object>
pub fn as_object(&self) -> Option<&Object>
Gets the value as an Object
.
Returns None
if the value is not an Object
.
Sourcepub fn unwrap_object(self) -> Object
pub fn unwrap_object(self) -> Object
Sourcepub fn as_struct(&self) -> Option<&Struct>
pub fn as_struct(&self) -> Option<&Struct>
Gets the value as a Struct
.
Returns None
if the value is not a Struct
.
Sourcepub fn unwrap_struct(self) -> Struct
pub fn unwrap_struct(self) -> Struct
Trait Implementations§
Source§impl Clone for CompoundValue
impl Clone for CompoundValue
Source§fn clone(&self) -> CompoundValue
fn clone(&self) -> CompoundValue
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Coercible for CompoundValue
impl Coercible for CompoundValue
Source§impl Debug for CompoundValue
impl Debug for CompoundValue
Source§impl Display for CompoundValue
impl Display for CompoundValue
Source§impl From<Array> for CompoundValue
impl From<Array> for CompoundValue
Source§impl From<CompoundValue> for Value
impl From<CompoundValue> for Value
Source§fn from(value: CompoundValue) -> Self
fn from(value: CompoundValue) -> Self
Converts to this type from the input type.
Source§impl From<Map> for CompoundValue
impl From<Map> for CompoundValue
Source§impl From<Object> for CompoundValue
impl From<Object> for CompoundValue
Source§impl From<Pair> for CompoundValue
impl From<Pair> for CompoundValue
Auto Trait Implementations§
impl Freeze for CompoundValue
impl RefUnwindSafe for CompoundValue
impl Send for CompoundValue
impl Sync for CompoundValue
impl Unpin for CompoundValue
impl UnwindSafe for CompoundValue
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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 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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.