Struct nutrimatic::ThinNode [−][src]
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]
fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,