Struct valence_nbt::compound::Compound
source · pub struct Compound<S = String> { /* private fields */ }
Implementations§
source§impl<S> Compound<S>
impl<S> Compound<S>
pub fn get<Q>(&self, k: &Q) -> Option<&Value<S>>where
Q: ?Sized + AsBorrowed<S>,
<Q as AsBorrowed<S>>::Borrowed: Hash + Ord,
S: Borrow<<Q as AsBorrowed<S>>::Borrowed>,
pub fn contains_key<Q>(&self, k: &Q) -> boolwhere
Q: ?Sized + AsBorrowed<S>,
<Q as AsBorrowed<S>>::Borrowed: Hash + Ord,
S: Borrow<<Q as AsBorrowed<S>>::Borrowed>,
pub fn get_mut<Q>(&mut self, k: &Q) -> Option<&mut Value<S>>where
Q: ?Sized + AsBorrowed<S>,
<Q as AsBorrowed<S>>::Borrowed: Hash + Ord,
S: Borrow<<Q as AsBorrowed<S>>::Borrowed>,
pub fn get_key_value<Q>(&self, k: &Q) -> Option<(&S, &Value<S>)>where
Q: ?Sized + AsBorrowed<S>,
<Q as AsBorrowed<S>>::Borrowed: Hash + Ord,
S: Borrow<<Q as AsBorrowed<S>>::Borrowed>,
pub fn insert<K, V>(&mut self, k: K, v: V) -> Option<Value<S>>
pub fn remove<Q>(&mut self, k: &Q) -> Option<Value<S>>where
Q: ?Sized + AsBorrowed<S>,
<Q as AsBorrowed<S>>::Borrowed: Hash + Ord,
S: Borrow<<Q as AsBorrowed<S>>::Borrowed>,
pub fn remove_entry<Q>(&mut self, k: &Q) -> Option<(S, Value<S>)>
pub fn append(&mut self, other: &mut Self)
pub fn entry<K>(&mut self, k: K) -> Entry<'_, S>where
K: Into<S>,
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn iter(&self) -> Iter<'_, S> ⓘ
pub fn iter_mut(&mut self) -> IterMut<'_, S> ⓘ
pub fn keys(&self) -> Keys<'_, S> ⓘ
pub fn values(&self) -> Values<'_, S> ⓘ
pub fn values_mut(&mut self) -> ValuesMut<'_, S> ⓘ
pub fn retain<F>(&mut self, f: F)
sourcepub fn merge(&mut self, other: Compound<S>)
pub fn merge(&mut self, other: Compound<S>)
Inserts all items from other
into self
recursively.
Example
use valence_nbt::compound;
let mut this = compound! {
"foo" => 10,
"bar" => compound! {
"baz" => 20,
}
};
let other = compound! {
"foo" => 15,
"bar" => compound! {
"quux" => "hello",
}
};
this.merge(other);
assert_eq!(
this,
compound! {
"foo" => 15,
"bar" => compound! {
"baz" => 20,
"quux" => "hello",
}
}
);
Trait Implementations§
source§impl<S> Extend<(S, Value<S>)> for Compound<S>
impl<S> Extend<(S, Value<S>)> for Compound<S>
source§fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = (S, Value<S>)>,
fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = (S, Value<S>)>,
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
source§impl<S> FromIterator<(S, Value<S>)> for Compound<S>
impl<S> FromIterator<(S, Value<S>)> for Compound<S>
source§impl<'a, S> IntoIterator for &'a Compound<S>
impl<'a, S> IntoIterator for &'a Compound<S>
source§impl<'a, S> IntoIterator for &'a mut Compound<S>
impl<'a, S> IntoIterator for &'a mut Compound<S>
source§impl<S> IntoIterator for Compound<S>
impl<S> IntoIterator for Compound<S>
Auto Trait Implementations§
impl<S> RefUnwindSafe for Compound<S>where
S: RefUnwindSafe,
impl<S> Send for Compound<S>where
S: Send,
impl<S> Sync for Compound<S>where
S: Sync,
impl<S> Unpin for Compound<S>
impl<S> UnwindSafe for Compound<S>where
S: 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
Mutably borrows from an owned value. Read more