pub(crate) struct SuggestionsBuilder<'input> {
input: &'input str,
start: usize,
byte_start: usize,
remaining_lowercase: String,
suggestions: Vec<Suggestion>,
}Expand description
Accumulates suggestions for one input suffix.
Fields§
§input: &'input str§start: usize§byte_start: usize§remaining_lowercase: String§suggestions: Vec<Suggestion>Implementations§
Source§impl<'input> SuggestionsBuilder<'input>
impl<'input> SuggestionsBuilder<'input>
Sourcepub(crate) fn new(
input: &'input str,
start: usize,
) -> Result<Self, SuggestionError>
pub(crate) fn new( input: &'input str, start: usize, ) -> Result<Self, SuggestionError>
Creates a builder at a UTF-16 input position.
Sourcepub(crate) fn remaining_lowercase(&self) -> &str
pub(crate) fn remaining_lowercase(&self) -> &str
Returns a lowercase copy of the suffix being replaced.
Sourcepub(crate) fn suggest(&mut self, text: impl Into<Box<str>>) -> &mut Self
pub(crate) fn suggest(&mut self, text: impl Into<Box<str>>) -> &mut Self
Adds a textual suggestion unless it is already the exact suffix.
Sourcepub(crate) fn suggest_with_tooltip(
&mut self,
text: impl Into<Box<str>>,
tooltip: impl Into<TextComponent>,
) -> &mut Self
pub(crate) fn suggest_with_tooltip( &mut self, text: impl Into<Box<str>>, tooltip: impl Into<TextComponent>, ) -> &mut Self
Adds a textual suggestion with a tooltip.
Sourcepub(crate) fn suggest_integer(&mut self, value: i32) -> &mut Self
pub(crate) fn suggest_integer(&mut self, value: i32) -> &mut Self
Adds an integer suggestion.
Sourcepub(crate) fn build(self) -> Result<Suggestions, SuggestionError>
pub(crate) fn build(self) -> Result<Suggestions, SuggestionError>
Builds, deduplicates, and sorts the accumulated suggestions.
Sourcepub(crate) fn restart(&self) -> Result<Self, SuggestionError>
pub(crate) fn restart(&self) -> Result<Self, SuggestionError>
Creates an empty builder with the same input and start.
fn range(&self) -> StringRange
Auto Trait Implementations§
impl<'input> Freeze for SuggestionsBuilder<'input>
impl<'input> RefUnwindSafe for SuggestionsBuilder<'input>
impl<'input> Send for SuggestionsBuilder<'input>
impl<'input> Sync for SuggestionsBuilder<'input>
impl<'input> Unpin for SuggestionsBuilder<'input>
impl<'input> UnsafeUnpin for SuggestionsBuilder<'input>
impl<'input> UnwindSafe for SuggestionsBuilder<'input>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 moreWraps this value in an
Arc<SyncMutex<>>