Struct ide::CompletionRelevance
source · pub struct CompletionRelevance {
pub exact_name_match: bool,
pub type_match: Option<CompletionRelevanceTypeMatch>,
pub is_local: bool,
pub trait_: Option<CompletionRelevanceTraitInfo>,
pub is_name_already_imported: bool,
pub requires_import: bool,
pub is_private_editable: bool,
pub postfix_match: Option<CompletionRelevancePostfixMatch>,
pub function: Option<CompletionRelevanceFn>,
}
Fields§
§exact_name_match: bool
This is set when the identifier being completed matches up with the name that is expected, like in a function argument.
fn f(spam: String) {}
fn main {
let spam = 92;
f($0) // name of local matches the name of param
}
type_match: Option<CompletionRelevanceTypeMatch>
See [CompletionRelevanceTypeMatch
].
is_local: bool
Set for local variables.
fn foo(a: u32) {
let b = 0;
$0 // `a` and `b` are local
}
trait_: Option<CompletionRelevanceTraitInfo>
Populated when the completion item comes from a trait (impl).
is_name_already_imported: bool
This is set when an import is suggested in a use item whose name is already imported.
requires_import: bool
This is set for completions that will insert a use
item.
is_private_editable: bool
Set for item completions that are private but in the workspace.
postfix_match: Option<CompletionRelevancePostfixMatch>
Set for postfix snippet item completions
function: Option<CompletionRelevanceFn>
This is set for items that are function (associated or method)
Implementations§
source§impl CompletionRelevance
impl CompletionRelevance
sourcepub fn score(self) -> u32
pub fn score(self) -> u32
Provides a relevance score. Higher values are more relevant.
The absolute value of the relevance score is not meaningful, for example a value of 0 doesn’t mean “not relevant”, rather it means “least relevant”. The score value should only be used for relative ordering.
See is_relevant if you need to make some judgement about score in an absolute sense.
sourcepub fn is_relevant(&self) -> bool
pub fn is_relevant(&self) -> bool
Returns true when the score for this threshold is above some threshold such that we think it is especially likely to be relevant.
Trait Implementations§
source§impl Clone for CompletionRelevance
impl Clone for CompletionRelevance
source§fn clone(&self) -> CompletionRelevance
fn clone(&self) -> CompletionRelevance
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for CompletionRelevance
impl Debug for CompletionRelevance
source§impl Default for CompletionRelevance
impl Default for CompletionRelevance
source§fn default() -> CompletionRelevance
fn default() -> CompletionRelevance
source§impl PartialEq for CompletionRelevance
impl PartialEq for CompletionRelevance
impl Copy for CompletionRelevance
impl Eq for CompletionRelevance
impl StructuralPartialEq for CompletionRelevance
Auto Trait Implementations§
impl Freeze for CompletionRelevance
impl RefUnwindSafe for CompletionRelevance
impl Send for CompletionRelevance
impl Sync for CompletionRelevance
impl Unpin for CompletionRelevance
impl UnwindSafe for CompletionRelevance
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<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
§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
key
and return 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>
§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