NetworkCompound

Struct NetworkCompound 

Source
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§

Methods from Deref<Target = Compound<S>>§

Source

pub fn clear(&mut self)

Source

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>,

Source

pub fn contains_key<Q>(&self, k: &Q) -> bool
where Q: ?Sized + AsBorrowed<S>, <Q as AsBorrowed<S>>::Borrowed: Hash + Ord, S: Borrow<<Q as AsBorrowed<S>>::Borrowed>,

Source

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>,

Source

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>,

Source

pub fn insert<K, V>(&mut self, k: K, v: V) -> Option<Value<S>>
where K: Into<S>, V: Into<Value<S>>,

Source

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>,

Source

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>,

Source

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>,

Source

pub fn remove_entry<Q>(&mut self, k: &Q) -> Option<(S, Value<S>)>
where S: Borrow<Q>, Q: ?Sized + Ord + Hash,

Source

pub fn swap_remove_entry<Q>(&mut self, k: &Q) -> Option<(S, Value<S>)>
where S: Borrow<Q>, Q: ?Sized + Ord + Hash,

Source

pub fn shift_remove_entry<Q>(&mut self, k: &Q) -> Option<(S, Value<S>)>
where S: Borrow<Q>, Q: ?Sized + Ord + Hash,

Source

pub fn append(&mut self, other: &mut Self)

Source

pub fn entry<K>(&mut self, k: K) -> Entry<'_, S>
where K: Into<S>,

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn iter(&self) -> Iter<'_, S>

Source

pub fn iter_mut(&mut self) -> IterMut<'_, S>

Source

pub fn keys(&self) -> Keys<'_, S>

Source

pub fn values(&self) -> Values<'_, S>

Source

pub fn values_mut(&mut self) -> ValuesMut<'_, S>

Source

pub fn retain<F>(&mut self, f: F)
where F: FnMut(&S, &mut Value<S>) -> bool,

Source

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>

Source§

fn clone(&self) -> NetworkCompound<S>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S: Default> Default for NetworkCompound<S>

Source§

fn default() -> NetworkCompound<S>

Returns the “default value” for a type. Read more
Source§

impl<S> Deref for NetworkCompound<S>

Source§

type Target = Compound<S>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<S> DerefMut for NetworkCompound<S>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.