Struct nutrimatic::ThinNode[][src]

pub struct ThinNode<'buf> { /* fields omitted */ }

A “thin” representation of a node in a trie.

ThinNode is like Node, but smaller (it omits the reference to the buffer containing the trie). It is intended to be used when there are a lot of nodes in memory at the same time and reducing their size is helpful for performance. Using only Node allows for slightly simpler code and should be done when the difference in performance (if any) doesn’t matter.

Thin nodes, like normal nodes, implement ordering and equality according to their frequency in order to accommodate using them in priority queues for best-first search.

Thin nodes are created by Node::to_thin and turned into normal nodes by Node::from_thin.

Implementations

impl<'buf> ThinNode<'buf>[src]

pub fn ch(&self) -> u8[src]

Returns the character associated with the node—i.e., the letter used to transition from this node’s parent to this node.

This value is not useful for a root node returned by Node::new.

pub fn freq(&self) -> u64[src]

Returns the frequency of the node—i.e., the total number of times that the corpus contains any phrase that starts with the sequence of characters corresponding to the path to this node (including this node’s own character).

Trait Implementations

impl<'buf> Clone for ThinNode<'buf>[src]

impl<'buf> Copy for ThinNode<'buf>[src]

impl<'buf> Debug for ThinNode<'buf>[src]

impl Eq for ThinNode<'_>[src]

impl Ord for ThinNode<'_>[src]

impl PartialEq<ThinNode<'_>> for ThinNode<'_>[src]

impl PartialOrd<ThinNode<'_>> for ThinNode<'_>[src]

Auto Trait Implementations

impl<'buf> RefUnwindSafe for ThinNode<'buf>

impl<'buf> Send for ThinNode<'buf>

impl<'buf> Sync for ThinNode<'buf>

impl<'buf> Unpin for ThinNode<'buf>

impl<'buf> UnwindSafe for ThinNode<'buf>

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.