[][src]Struct nobility::bin_decode::Compound

pub struct Compound<'a> { /* fields omitted */ }

Represents TAG_Compound, a list of key/value pairs. The order of the entries is the same that they appear in the file, although this usually is not significant.

Example

if let Some(entry) = compound.find_first_key("Health") {
    if let Some(health) = entry.value().to_i64() {
        println!("Player has {} health", health);
    }
}

Implementations

impl<'a> Compound<'a>[src]

pub fn len(&self) -> usize[src]

Returns the number of entries.

pub fn is_empty(&self) -> bool[src]

Returns true if there are no entries.

pub fn into_vec(self) -> Vec<Entry<'a>>[src]

Converts into a Vec of key/value pairs.

pub fn find_first_key(&self, key: &str) -> Option<&Entry<'a>>[src]

Searches for the first key that matches the input, and returns it if it exists.

pub fn iter(&self) -> SliceIter<'_, Entry<'a>>[src]

Returns an iterator over the entries.

pub fn entries(&self) -> &[Entry<'a>][src]

Trait Implementations

impl<'a> Clone for Compound<'a>[src]

impl<'a> Debug for Compound<'a>[src]

impl<'a> Index<usize> for Compound<'a>[src]

type Output = Entry<'a>

The returned type after indexing.

impl<'a> PartialEq<Compound<'a>> for Compound<'a>[src]

impl<'a> StructuralPartialEq for Compound<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Compound<'a>[src]

impl<'a> Send for Compound<'a>[src]

impl<'a> Sync for Compound<'a>[src]

impl<'a> Unpin for Compound<'a>[src]

impl<'a> UnwindSafe for Compound<'a>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.