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
impl DomainStack
Sourcepub fn new() -> DomainStack
pub fn new() -> DomainStack
Create an empty domain stack.
Sourcepub fn add_domain(
&mut self,
domain: DomainId,
priority: u8,
dict: Arc<UserDictionary>,
source: Option<PathBuf>,
)
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.
Sourcepub fn remove_domain(&mut self, domain: &DomainId) -> Option<DomainDictionary>
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.
Sourcepub fn get_domain(&self, domain: &DomainId) -> Option<&DomainDictionary>
pub fn get_domain(&self, domain: &DomainId) -> Option<&DomainDictionary>
Look up a domain by id.
Sourcepub fn list_domains(&self) -> Vec<(DomainId, u8, usize)>
pub fn list_domains(&self) -> Vec<(DomainId, u8, usize)>
Return (DomainId, priority, entry_count) for every registered domain,
in priority order (highest priority first).
Sourcepub fn common_prefix_search<'a>(&'a self, text: &str) -> Vec<&'a UserEntry>
pub fn common_prefix_search<'a>(&'a self, text: &str) -> Vec<&'a UserEntry>
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.
Trait Implementations§
Source§impl Debug for DomainStack
impl Debug for DomainStack
Source§impl Default for DomainStack
impl Default for DomainStack
Source§fn default() -> DomainStack
fn default() -> DomainStack
Auto Trait Implementations§
impl Freeze for DomainStack
impl RefUnwindSafe for DomainStack
impl Send for DomainStack
impl Sync for DomainStack
impl Unpin for DomainStack
impl UnsafeUnpin for DomainStack
impl UnwindSafe for DomainStack
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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