Struct transition_table::Entry
source · [−]pub struct Entry<K, V> { /* private fields */ }Expand description
Trie generator.
const KEYWORDS: [(&'static str, i8); 3] = [
("A", 1),
("BB", 2),
("BBC", 3),
];
let tree = Entry::<char, _>::new(KEYWORDS.iter());
let tbl: Vec<Transition<_, _, _>> = tree.into();
let mut it = tbl.iter();
assert_eq!(it.next().unwrap(), &('C', 0usize, 0usize, 2usize));
assert_eq!(it.next().unwrap(), &('B', 0usize, 1usize, 1usize));
assert_eq!(it.next().unwrap(), &('A', 0usize, 0usize, 0usize));
assert_eq!(it.next().unwrap(), &('B', 1usize, 2usize, !0usize));
assert_eq!(it.next().unwrap(), &('\u{0}', 2usize, 4usize, !0usize));
assert!(it.next().is_none());Implementations
sourceimpl<K, V> Entry<K, V> where
K: Copy + Ord,
V: Optional,
impl<K, V> Entry<K, V> where
K: Copy + Ord,
V: Optional,
sourcepub fn push<I>(&mut self, key: I, v: V::Inner) where
I: IntoIterator<Item = K>,
pub fn push<I>(&mut self, key: I, v: V::Inner) where
I: IntoIterator<Item = K>,
Pushing a single entry.
sourcepub fn push_to(
&self,
tbl: &mut Vec<Transition<K, usize, V>>
) -> Transition<K, usize, V>
pub fn push_to(
&self,
tbl: &mut Vec<Transition<K, usize, V>>
) -> Transition<K, usize, V>
Generating trie.
Trait Implementations
Auto Trait Implementations
impl<K, V> RefUnwindSafe for Entry<K, V> where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for Entry<K, V> where
K: Send,
V: Send,
impl<K, V> Sync for Entry<K, V> where
K: Sync,
V: Sync,
impl<K, V> Unpin for Entry<K, V> where
K: Unpin,
V: Unpin,
impl<K, V> UnwindSafe for Entry<K, V> where
K: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more