pub struct NetworkCompound<S = String> {
pub compound: Compound<S>,
}Expand description
A wrapper around Compound that encodes and decodes as network NBT
Fields§
§compound: Compound<S>Implementations§
Source§impl<S> NetworkCompound<S>
impl<S> NetworkCompound<S>
pub fn from(inner: Compound<S>) -> NetworkCompound<S>
Methods from Deref<Target = Compound<S>>§
pub fn clear(&mut self)
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 swap_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 shift_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 swap_remove_entry<Q>(&mut self, k: &Q) -> Option<(S, Value<S>)>
pub fn shift_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 chunkedge_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: Clone> Clone for NetworkCompound<S>
impl<S: Clone> Clone for NetworkCompound<S>
Source§fn clone(&self) -> NetworkCompound<S>
fn clone(&self) -> NetworkCompound<S>
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<S: Default> Default for NetworkCompound<S>
impl<S: Default> Default for NetworkCompound<S>
Source§fn default() -> NetworkCompound<S>
fn default() -> NetworkCompound<S>
Returns the “default value” for a type. Read more
Source§impl<S> Deref for NetworkCompound<S>
impl<S> Deref for NetworkCompound<S>
Auto Trait Implementations§
impl<S> Freeze for NetworkCompound<S>
impl<S> RefUnwindSafe for NetworkCompound<S>where
S: RefUnwindSafe,
impl<S> Send for NetworkCompound<S>where
S: Send,
impl<S> Sync for NetworkCompound<S>where
S: Sync,
impl<S> Unpin for NetworkCompound<S>where
S: Unpin,
impl<S> UnwindSafe for NetworkCompound<S>where
S: UnwindSafe,
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