SmallResolver

Struct SmallResolver 

Source
pub struct SmallResolver<S, K, V>
where S: ResolverState, K: AsRef<str> + Eq,
{ /* private fields */ }
Expand description

A fast resolver with a small, fixed-size cache.

This resolver imposes no restrictions on the variable names you can use and is generally faster than the default resolver due to its compact cache and improved cache locality.

§Advantages

  • No restrictions on variable or function names.
  • The cache is small and compact, reducing memory usage and improving cache locality.

§Disadvantages

  • Limited cache size. Not recommended more than 10 items.

§Performance

  • Up to 10 variables: Maximum performance is achieved thanks to cache locality.
  • 10 to 30 variables: Performance remains good, though cache misses may occur more frequently.
  • More than 30 variables: Not recommended; beyond this point, the default resolver is typically faster.

Implementations§

Source§

impl<K, V> SmallResolver<Unlocked, K, V>
where K: AsRef<str> + Eq,

Source

pub fn new() -> Self

Source

pub fn insert(&mut self, name: K, value: V)

Trait Implementations§

Source§

impl<S, K, V> Resolver<S, V> for SmallResolver<S, K, V>
where S: ResolverState, K: AsRef<str> + Eq,

Source§

fn resolve(&self, name: &str) -> Option<&V>

Auto Trait Implementations§

§

impl<S, K, V> Freeze for SmallResolver<S, K, V>
where S: Freeze,

§

impl<S, K, V> RefUnwindSafe for SmallResolver<S, K, V>

§

impl<S, K, V> Send for SmallResolver<S, K, V>
where S: Send, K: Send, V: Send,

§

impl<S, K, V> Sync for SmallResolver<S, K, V>
where S: Sync, K: Sync, V: Sync,

§

impl<S, K, V> Unpin for SmallResolver<S, K, V>
where S: Unpin, K: Unpin, V: Unpin,

§

impl<S, K, V> UnwindSafe for SmallResolver<S, K, V>
where S: UnwindSafe, K: UnwindSafe, 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<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.