pub struct ChatCompleter {
commands: Vec<String>,
friends: Vec<String>,
discovered_peers: Vec<String>,
}Fields§
§commands: Vec<String>A list of available commands.
friends: Vec<String>A list of known friends (e.g., nicknames or PeerIds).
discovered_peers: Vec<String>A list of recently discovered peers.
Implementations§
Source§impl ChatCompleter
impl ChatCompleter
Sourcepub fn new(friends: Vec<String>) -> Self
pub fn new(friends: Vec<String>) -> Self
Creates a new ChatCompleter instance.
§Arguments
friends- An initial list of friends to use for autocompletion.
Sourcepub fn update_friends(&mut self, friends: Vec<String>)
pub fn update_friends(&mut self, friends: Vec<String>)
Updates the list of friends used for autocompletion.
Sourcepub fn update_discovered_peers(&mut self, peers: Vec<String>)
pub fn update_discovered_peers(&mut self, peers: Vec<String>)
Updates the list of discovered peers used for autocompletion.
Sourcepub fn get_suggestions(&self, input: &str) -> Vec<String>
pub fn get_suggestions(&self, input: &str) -> Vec<String>
Sourcefn fuzzy_match(&self, pattern: &str, text: &str) -> bool
fn fuzzy_match(&self, pattern: &str, text: &str) -> bool
Performs a fuzzy match between a pattern and a text.
This checks if all characters in the pattern appear in the text
in the same order, but not necessarily contiguously.
§Arguments
pattern- The pattern string to match.text- The text string to search within.
§Returns
true if a fuzzy match is found, false otherwise.
Trait Implementations§
Source§impl Clone for ChatCompleter
impl Clone for ChatCompleter
Source§fn clone(&self) -> ChatCompleter
fn clone(&self) -> ChatCompleter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ChatCompleter
impl RefUnwindSafe for ChatCompleter
impl Send for ChatCompleter
impl Sync for ChatCompleter
impl Unpin for ChatCompleter
impl UnwindSafe for ChatCompleter
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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 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>
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