pub enum OptimizedValue {
Null,
Bool(bool),
Int(i64),
Float(f64),
String(Rc<String>),
Sequence(Rc<Vec<OptimizedValue>>),
Mapping(Rc<IndexMap<OptimizedValue, OptimizedValue>>),
}Expand description
An optimized YAML value that minimizes allocations
Variants§
Null
Null value
Bool(bool)
Boolean value
Int(i64)
Integer value
Float(f64)
Float value
String(Rc<String>)
String value (using Rc for cheap cloning)
Sequence(Rc<Vec<OptimizedValue>>)
Sequence value (using Rc for cheap cloning)
Mapping(Rc<IndexMap<OptimizedValue, OptimizedValue>>)
Mapping value (using Rc for cheap cloning)
Implementations§
Source§impl OptimizedValue
impl OptimizedValue
Sourcepub fn sequence_with(values: Vec<Self>) -> Self
pub fn sequence_with(values: Vec<Self>) -> Self
Create a sequence with values
Sourcepub fn mapping_with(pairs: Vec<(Self, Self)>) -> Self
pub fn mapping_with(pairs: Vec<(Self, Self)>) -> Self
Create a mapping with key-value pairs
Sourcepub fn as_sequence(&self) -> Option<&[OptimizedValue]>
pub fn as_sequence(&self) -> Option<&[OptimizedValue]>
Get a reference to the sequence if this is a sequence value
Sourcepub fn as_mapping(&self) -> Option<&IndexMap<OptimizedValue, OptimizedValue>>
pub fn as_mapping(&self) -> Option<&IndexMap<OptimizedValue, OptimizedValue>>
Get a reference to the mapping if this is a mapping value
Sourcepub fn from_value(value: Value) -> Self
pub fn from_value(value: Value) -> Self
Convert from regular Value
Trait Implementations§
Source§impl Clone for OptimizedValue
impl Clone for OptimizedValue
Source§fn clone(&self) -> OptimizedValue
fn clone(&self) -> OptimizedValue
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 Debug for OptimizedValue
impl Debug for OptimizedValue
Source§impl Display for OptimizedValue
impl Display for OptimizedValue
Source§impl Hash for OptimizedValue
impl Hash for OptimizedValue
Source§impl PartialEq for OptimizedValue
impl PartialEq for OptimizedValue
impl Eq for OptimizedValue
impl StructuralPartialEq for OptimizedValue
Auto Trait Implementations§
impl Freeze for OptimizedValue
impl RefUnwindSafe for OptimizedValue
impl !Send for OptimizedValue
impl !Sync for OptimizedValue
impl Unpin for OptimizedValue
impl UnwindSafe for OptimizedValue
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.