[−][src]Enum gf::support::bitpat::BitPatTableNode
A node in the decision tree of a BitPatTable
.
The normal way of dealing with pattern tables does not require to use this
structure directly, use BitPatTableBuilder
instead.
Variants
Accept node.
Reject node.
Internal fork node.
Fields of Fork
prongs: Vec<BitPatTableNode<T>>
Links to nodes to be considered in order.
Internal dense node.
Fields of Dense
mask: u128
Mask of bits that form the lookup key; the mask may have at most 8 set bits.
table: Vec<BitPatTableNode<T>>
Link table, has 2n items where n is the number of set
bits in mask
.
Internal sparse node.
Fields of Sparse
mask: u128
Mask of bits that form the lookup key; the mask may have at most 8 set bits.
table: HashMap<u8, BitPatTableNode<T>>
Link table; keys that have no values are assumed to be Reject
.
Implementations
impl<T> BitPatTableNode<T>
[src]
pub fn get(&self, input: u128, input_bit_len: usize) -> Option<&T>
[src]
Query the subtree for an input, returning Some
for an Accept
node,
and None
for a Reject
node.
Errors
- Panics if
input_bit_len
is greater than 128.
pub fn is_accept(&self) -> bool
[src]
Return whether this is an Accept
node.
pub fn is_reject(&self) -> bool
[src]
Return whether this is a Reject
node.
pub fn into_sparse(self) -> Self
[src]
Recursively replace Dense
nodes which have more Reject
items than
non-Reject
items with Sparse
nodes.
Trait Implementations
impl<T: Clone> Clone for BitPatTableNode<T>
[src]
fn clone(&self) -> BitPatTableNode<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug> Debug for BitPatTableNode<T>
[src]
impl<T: Eq> Eq for BitPatTableNode<T>
[src]
impl<T: PartialEq> PartialEq<BitPatTableNode<T>> for BitPatTableNode<T>
[src]
fn eq(&self, other: &BitPatTableNode<T>) -> bool
[src]
fn ne(&self, other: &BitPatTableNode<T>) -> bool
[src]
impl<T> StructuralEq for BitPatTableNode<T>
[src]
impl<T> StructuralPartialEq for BitPatTableNode<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for BitPatTableNode<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for BitPatTableNode<T> where
T: Send,
T: Send,
impl<T> Sync for BitPatTableNode<T> where
T: Sync,
T: Sync,
impl<T> Unpin for BitPatTableNode<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for BitPatTableNode<T> where
T: UnwindSafe,
T: UnwindSafe,
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<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[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>,