Struct sozu_lib::router::pattern_trie::TrieNode

source ·
pub struct TrieNode<V> { /* private fields */ }
Expand description

Implementation of a trie tree structure. In Sozu this is used to store and lookup domains recursively. Each node represents a “level domain”. A leaf node (leftmost label) can be a wildcard, a regex pattern or a plain string. Leaves also store a value associated with the complete domain. For Sozu it is a list of (PathRule, MethodRule, ClusterId). See the Router strucure.

Implementations§

source§

impl<V: Debug + Clone> TrieNode<V>

source

pub fn new(key: Key, value: V) -> TrieNode<V>

source

pub fn wildcard(key: Key, value: V) -> TrieNode<V>

source

pub fn root() -> TrieNode<V>

source

pub fn is_empty(&self) -> bool

source

pub fn insert(&mut self, key: Key, value: V) -> InsertResult

source

pub fn insert_recursive( &mut self, partial_key: &[u8], key: &Key, value: V ) -> InsertResult

source

pub fn remove(&mut self, key: &Key) -> RemoveResult

source

pub fn remove_recursive(&mut self, partial_key: &[u8]) -> RemoveResult

source

pub fn lookup( &self, partial_key: &[u8], accept_wildcard: bool ) -> Option<&KeyValue<Key, V>>

source

pub fn lookup_mut( &mut self, partial_key: &[u8], accept_wildcard: bool ) -> Option<&mut KeyValue<Key, V>>

source

pub fn print(&self)

source

pub fn print_recursive(&self, partial_key: &[u8], indent: u8)

source

pub fn domain_insert(&mut self, key: Key, value: V) -> InsertResult

source

pub fn domain_remove(&mut self, key: &Key) -> RemoveResult

source

pub fn domain_lookup( &self, key: &[u8], accept_wildcard: bool ) -> Option<&KeyValue<Key, V>>

source

pub fn domain_lookup_mut( &mut self, key: &[u8], accept_wildcard: bool ) -> Option<&mut KeyValue<Key, V>>

source

pub fn size(&self) -> usize

source

pub fn to_hashmap(&self) -> HashMap<Key, V>

source

pub fn to_hashmap_recursive(&self, h: &mut HashMap<Key, V>)

Trait Implementations§

source§

impl<V: Debug> Debug for TrieNode<V>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<V: PartialEq> PartialEq for TrieNode<V>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl<V> Freeze for TrieNode<V>
where V: Freeze,

§

impl<V> RefUnwindSafe for TrieNode<V>
where V: RefUnwindSafe,

§

impl<V> Send for TrieNode<V>
where V: Send,

§

impl<V> Sync for TrieNode<V>
where V: Sync,

§

impl<V> Unpin for TrieNode<V>
where V: Unpin,

§

impl<V> UnwindSafe for TrieNode<V>
where V: UnwindSafe,

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

source§

fn implicit( self, class: Class, constructed: bool, tag: u32 ) -> TaggedParser<'a, Implicit, Self, E>

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V