[][src]Enum listinfo::Node

pub enum Node<T> {
    Unique(T),
    Many(Vec<T>),
}

Represents nodes with the given key in an ListInfo entry.

The split between Unique and Many is mostly for performance reasons to avoid unnecessary allocations. Node::Unique appeared exactly once in the parsed DAT file, while Node::Unique appeared more than once.

Instead of accessing the enum members directly, the Node::iter and Node::unique methods abstract over the difference between Unique and Many for convenience.

Variants

Unique(T)

A uniquely keyed node (only one of such key exists in the entry)

Many(Vec<T>)

Multiple nodes with the same key.

Implementations

impl<'a, T> Node<T>[src]

pub fn iter(&'a self) -> NodeIter<'a, T>[src]

Gets the values with the given key.

If the provided key is a unique value, returns an iterator that yields that single value.

pub fn unique(&'a self) -> &T[src]

Gets a single value with the given key.

If the provided key is not unique, retrieves the first value of the many-set with the given key.

Trait Implementations

impl<T: Debug> Debug for Node<T>[src]

impl<T: Eq> Eq for Node<T>[src]

impl<'de> IntoDeserializer<'de, Error> for &'de Node<&'de str>[src]

type Deserializer = NodeDeserializer<'de, &'de str>

The type of the deserializer being converted into.

impl<'de> IntoDeserializer<'de, Error> for &'de Node<EntryData<'de>>[src]

type Deserializer = NodeDeserializer<'de, EntryData<'de>>

The type of the deserializer being converted into.

impl<T: PartialEq> PartialEq<Node<T>> for Node<T>[src]

impl<T> StructuralEq for Node<T>[src]

impl<T> StructuralPartialEq for Node<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Node<T> where
    T: RefUnwindSafe

impl<T> Send for Node<T> where
    T: Send

impl<T> Sync for Node<T> where
    T: Sync

impl<T> Unpin for Node<T> where
    T: Unpin

impl<T> UnwindSafe for Node<T> where
    T: UnwindSafe

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<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

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

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

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.