pub struct Assist {
pub id: AssistId,
pub label: Label,
pub group: Option<GroupLabel>,
pub target: TextRange,
pub source_change: Option<SourceChange>,
pub command: Option<Command>,
}
Fields§
§id: AssistId
§label: Label
Short description of the assist, as shown in the UI.
group: Option<GroupLabel>
§target: TextRange
Target ranges are used to sort assists: the smaller the target range, the more specific assist is, and so it should be sorted first.
source_change: Option<SourceChange>
Computing source change sometimes is much more costly then computing the other fields. Additionally, the actual change is not required to show the lightbulb UI, it only is needed when the user tries to apply an assist. So, we compute it lazily: the API allow requesting assists with or without source change. We could (and in fact, used to) distinguish between resolved and unresolved assists at the type level, but this is cumbersome, especially if you want to embed an assist into another data structure, such as a diagnostic.
command: Option<Command>
The command to execute after the assist is applied.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Assist
impl RefUnwindSafe for Assist
impl Send for Assist
impl Sync for Assist
impl Unpin for Assist
impl UnwindSafe for Assist
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
§impl<T> Cast for T
impl<T> Cast for T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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