pub(crate) struct Suggestion {
range: StringRange,
text: Box<str>,
tooltip: Option<TextComponent>,
integer: Option<i32>,
}Expand description
One replacement offered for a command input range.
Fields§
§range: StringRange§text: Box<str>§tooltip: Option<TextComponent>§integer: Option<i32>Implementations§
Source§impl Suggestion
impl Suggestion
Sourcepub(crate) fn new(range: StringRange, text: impl Into<Box<str>>) -> Self
pub(crate) fn new(range: StringRange, text: impl Into<Box<str>>) -> Self
Creates a textual suggestion.
Sourcepub(crate) fn with_tooltip(
range: StringRange,
text: impl Into<Box<str>>,
tooltip: impl Into<TextComponent>,
) -> Self
pub(crate) fn with_tooltip( range: StringRange, text: impl Into<Box<str>>, tooltip: impl Into<TextComponent>, ) -> Self
Creates a textual suggestion with a tooltip.
fn integer(range: StringRange, value: i32) -> Self
Sourcepub(crate) const fn range(&self) -> StringRange
pub(crate) const fn range(&self) -> StringRange
Returns the replacement range.
Sourcepub(crate) fn apply(&self, input: &str) -> Result<String, SuggestionError>
pub(crate) fn apply(&self, input: &str) -> Result<String, SuggestionError>
Applies this replacement to input.
fn expand( &self, input: &str, range: StringRange, ) -> Result<Self, SuggestionError>
fn checked_byte_range( input: &str, range: StringRange, ) -> Result<Range<usize>, SuggestionError>
fn compare_ignore_case(&self, other: &Self) -> Ordering
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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Suggestion
impl Debug for Suggestion
impl Eq for Suggestion
Source§impl Hash for Suggestion
impl Hash for Suggestion
Source§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 UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compares
self with key and returns true if they are equal.§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<>>