Skip to main content

DomainStack

Struct DomainStack 

Source
pub struct DomainStack { /* private fields */ }
Expand description

Ordered stack of domain dictionaries searched in priority order.

The internal vector is kept sorted by priority ascending (lowest value = highest priority) at all times. add_domain and remove_domain preserve this invariant.

Implementations§

Source§

impl DomainStack

Source

pub fn new() -> DomainStack

Create an empty domain stack.

Source

pub fn add_domain( &mut self, domain: DomainId, priority: u8, dict: Arc<UserDictionary>, source: Option<PathBuf>, )

Add or replace a domain.

If a domain with the same DomainId already exists it is replaced with the new dictionary and priority. The stack remains sorted after the operation.

Source

pub fn remove_domain(&mut self, domain: &DomainId) -> Option<DomainDictionary>

Remove a domain by id.

Returns the removed DomainDictionary, or None if no domain with the given id existed.

Source

pub fn get_domain(&self, domain: &DomainId) -> Option<&DomainDictionary>

Look up a domain by id.

Source

pub fn list_domains(&self) -> Vec<(DomainId, u8, usize)>

Return (DomainId, priority, entry_count) for every registered domain, in priority order (highest priority first).

Source

pub fn len(&self) -> usize

Number of registered domains.

Source

pub fn is_empty(&self) -> bool

True when no domains are registered.

Common-prefix search across all domains.

Returns all matching UserEntry references in priority order (higher priority = lower numeric value appears first). Within the same domain, entry order follows the domain’s own iteration order.

The returned references are valid for the lifetime of &self.

Source

pub fn lookup<'a>(&'a self, surface: &str) -> Vec<&'a UserEntry>

Exact surface lookup across all domains.

Returns all UserEntry references whose surface equals surface, in priority order.

The returned references are valid for the lifetime of &self.

Trait Implementations§

Source§

impl Debug for DomainStack

Source§

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

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

impl Default for DomainStack

Source§

fn default() -> DomainStack

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.