Struct Trie

Source
pub struct Trie<T, K> { /* private fields */ }
Expand description

Trie木

Implementations§

Source§

impl<T, K: Copy + Hash + Eq> Trie<T, K>

Source

pub fn new(value: T) -> Self

valueを保持するルートのみをもつTrieを構築する。

Source

pub fn root_node(&self) -> &TrieNode<T, K>

Trie木の根ノードへの参照を返す。

Source

pub fn root_node_mut(&mut self) -> &mut TrieNode<T, K>

Trie木の根ノードへの可変参照を返す。

Source

pub fn add<I, FI, F1, F2>(&mut self, s: I, init: FI, proc: F1, rproc: F2)
where I: IntoIterator<Item = K>, FI: FnMut(&Vec<K>) -> T, F1: FnMut(&mut T, &Vec<K>), F2: FnMut(&mut T, &Vec<K>),

sをTrie木に追加する。

  • init: ノードが新しく追加されるときの初期値を決定する。
  • proc: 行きがけ順に、ノードの値に処理をする。
  • rproc: 帰りがけ順に、ノードの値に処理をする。

Auto Trait Implementations§

§

impl<T, K> Freeze for Trie<T, K>

§

impl<T, K> RefUnwindSafe for Trie<T, K>

§

impl<T, K> !Send for Trie<T, K>

§

impl<T, K> !Sync for Trie<T, K>

§

impl<T, K> Unpin for Trie<T, K>

§

impl<T, K> UnwindSafe for Trie<T, K>

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