pub struct Object { /* private fields */ }Expand description
Type representing a HCL object.
Implementations§
source§impl Object
 
impl Object
sourcepub fn with_capacity(capacity: usize) -> Self
 
pub fn with_capacity(capacity: usize) -> Self
Constructs a new, empty Object with at least the specified capacity.
sourcepub fn len(&self) -> usize
 
pub fn len(&self) -> usize
Returns the number of items in the object, also referred to as its ‘length’.
sourcepub fn contains_key(&self, key: &ObjectKey) -> bool
 
pub fn contains_key(&self, key: &ObjectKey) -> bool
Return true if an equivalent to key exists in the object.
sourcepub fn get(&self, key: &ObjectKey) -> Option<&ObjectValue>
 
pub fn get(&self, key: &ObjectKey) -> Option<&ObjectValue>
Return a reference to the value stored for key, if it is present, else None.
sourcepub fn get_mut(&mut self, key: &ObjectKey) -> Option<&mut ObjectValue>
 
pub fn get_mut(&mut self, key: &ObjectKey) -> Option<&mut ObjectValue>
Return a mutable reference to the value stored for key, if it is present, else None.
sourcepub fn get_key_value(
    &self,
    key: &ObjectKey,
) -> Option<(&ObjectKey, &ObjectValue)>
 
pub fn get_key_value( &self, key: &ObjectKey, ) -> Option<(&ObjectKey, &ObjectValue)>
Return references to the key-value pair stored for key, if it is present, else None.
sourcepub fn get_key_value_mut<'a>(
    &'a mut self,
    key: &ObjectKey,
) -> Option<(ObjectKeyMut<'a>, &'a mut ObjectValue)>
 
pub fn get_key_value_mut<'a>( &'a mut self, key: &ObjectKey, ) -> Option<(ObjectKeyMut<'a>, &'a mut ObjectValue)>
Return mutable references to the key-value pair stored for key, if it is present, else None.
sourcepub fn insert(
    &mut self,
    key: impl Into<ObjectKey>,
    value: impl Into<ObjectValue>,
) -> Option<ObjectValue>
 
pub fn insert( &mut self, key: impl Into<ObjectKey>, value: impl Into<ObjectValue>, ) -> Option<ObjectValue>
Insert a key-value pair into the object.
If an equivalent key already exists in the object: the key remains and retains in its place
in the order, its corresponding value is updated with value and the older value is
returned inside Some(_).
If no equivalent key existed in the object: the new key-value pair is inserted, last in
order, and None is returned.
sourcepub fn remove(&mut self, key: &ObjectKey) -> Option<ObjectValue>
 
pub fn remove(&mut self, key: &ObjectKey) -> Option<ObjectValue>
Remove the key-value pair equivalent to key and return its value.
Like Vec::remove, the pair is removed by shifting all of the elements that follow it,
preserving their relative order. This perturbs the index of all of those elements!
sourcepub fn remove_entry(
    &mut self,
    key: &ObjectKey,
) -> Option<(ObjectKey, ObjectValue)>
 
pub fn remove_entry( &mut self, key: &ObjectKey, ) -> Option<(ObjectKey, ObjectValue)>
Remove and return the key-value pair equivalent to key.
Like Vec::remove, the pair is removed by shifting all of the elements that follow it,
preserving their relative order. This perturbs the index of all of those elements!
sourcepub fn iter(&self) -> ObjectIter<'_>
 
pub fn iter(&self) -> ObjectIter<'_>
An iterator visiting all key-value pairs in insertion order. The iterator element type is
(&'a ObjectKey, &'a ObjectValue).
sourcepub fn iter_mut(&mut self) -> ObjectIterMut<'_>
 
pub fn iter_mut(&mut self) -> ObjectIterMut<'_>
An iterator visiting all key-value pairs in insertion order, with mutable references to the
values. The iterator element type is (ObjectKeyMut<'a>, &'a mut ObjectValue).
sourcepub fn trailing(&self) -> &RawString
 
pub fn trailing(&self) -> &RawString
Return a reference to raw trailing decor before the object’s closing }.
sourcepub fn set_trailing(&mut self, trailing: impl Into<RawString>)
 
pub fn set_trailing(&mut self, trailing: impl Into<RawString>)
Set the raw trailing decor before the object’s closing }.
Trait Implementations§
source§impl<K, V> Extend<(K, V)> for Object
 
impl<K, V> Extend<(K, V)> for Object
source§fn extend<I>(&mut self, iterable: I)where
    I: IntoIterator<Item = (K, V)>,
 
fn extend<I>(&mut self, iterable: I)where
    I: IntoIterator<Item = (K, V)>,
source§fn extend_one(&mut self, item: A)
 
fn extend_one(&mut self, item: A)
extend_one)source§fn extend_reserve(&mut self, additional: usize)
 
fn extend_reserve(&mut self, additional: usize)
extend_one)source§impl From<Object> for Expression
 
impl From<Object> for Expression
source§impl<K, V> FromIterator<(K, V)> for Object
 
impl<K, V> FromIterator<(K, V)> for Object
source§impl<'a> IntoIterator for &'a Object
 
impl<'a> IntoIterator for &'a Object
source§impl<'a> IntoIterator for &'a mut Object
 
impl<'a> IntoIterator for &'a mut Object
source§type Item = (ObjectKeyMut<'a>, &'a mut ObjectValue)
 
type Item = (ObjectKeyMut<'a>, &'a mut ObjectValue)
source§type IntoIter = Box<dyn Iterator<Item = (ObjectKeyMut<'a>, &'a mut ObjectValue)> + 'a>
 
type IntoIter = Box<dyn Iterator<Item = (ObjectKeyMut<'a>, &'a mut ObjectValue)> + 'a>
source§impl IntoIterator for Object
 
impl IntoIterator for Object
impl Eq for Object
Auto Trait Implementations§
impl Freeze for Object
impl RefUnwindSafe for Object
impl Send for Object
impl Sync for Object
impl Unpin for Object
impl UnwindSafe for Object
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
 
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)