pub struct Suggestion { /* private fields */ }Expand description
Suggestion for completion.
Implementations§
Source§impl Suggestion
impl Suggestion
Sourcepub fn new(name: &str, description: &str) -> Self
pub fn new(name: &str, description: &str) -> Self
Returns a new suggestion with a name and description
Examples found in repository?
examples/basic.rs (line 9)
7 fn get_suggestions(&self, doc: Document) -> Vec<Suggestion> {
8 let mut suggestions = vec![
9 Suggestion::new("find", "Find something"),
10 Suggestion::new("go", "Go somewhere"),
11 Suggestion::new("die", "kills something"),
12 Suggestion::new("flame", "flames something"),
13 Suggestion::new("Blank_Desc", ""),
14 ];
15 let filter = doc.get_word_before_cursor_until_sep(' ');
16 if filter == "" {
17 suggestions
18 } else {
19 suggestions.retain(|v| v.get_name().contains(filter));
20 suggestions
21 }
22 }Sourcepub fn get_name(&self) -> &str
pub fn get_name(&self) -> &str
Returns the name.
Examples found in repository?
examples/basic.rs (line 19)
7 fn get_suggestions(&self, doc: Document) -> Vec<Suggestion> {
8 let mut suggestions = vec![
9 Suggestion::new("find", "Find something"),
10 Suggestion::new("go", "Go somewhere"),
11 Suggestion::new("die", "kills something"),
12 Suggestion::new("flame", "flames something"),
13 Suggestion::new("Blank_Desc", ""),
14 ];
15 let filter = doc.get_word_before_cursor_until_sep(' ');
16 if filter == "" {
17 suggestions
18 } else {
19 suggestions.retain(|v| v.get_name().contains(filter));
20 suggestions
21 }
22 }Sourcepub fn get_description(&self) -> &str
pub fn get_description(&self) -> &str
Returns the description.
Trait Implementations§
Source§impl Clone for Suggestion
impl Clone for Suggestion
Source§fn clone(&self) -> Suggestion
fn clone(&self) -> Suggestion
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 moreSource§impl PartialEq for Suggestion
impl PartialEq for Suggestion
impl StructuralPartialEq for Suggestion
Auto Trait Implementations§
impl Freeze for Suggestion
impl RefUnwindSafe for Suggestion
impl Send for Suggestion
impl Sync for Suggestion
impl Unpin for Suggestion
impl UnwindSafe for Suggestion
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