Struct ra_ap_ide::CompletionRelevance
source · pub struct CompletionRelevance {
pub exact_name_match: bool,
pub type_match: Option<CompletionRelevanceTypeMatch>,
pub is_local: bool,
pub is_item_from_trait: bool,
pub is_item_from_notable_trait: bool,
pub is_name_already_imported: bool,
pub requires_import: bool,
pub is_op_method: bool,
pub is_private_editable: bool,
pub postfix_match: Option<CompletionRelevancePostfixMatch>,
pub is_definite: bool,
pub function: Option<CompletionRelevanceFn>,
}
Fields§
§exact_name_match: bool
This is set in cases like these:
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 doc comments for cases where this is set.
is_local: bool
This is set in cases like these:
fn foo(a: u32) {
let b = 0;
$0 // `a` and `b` are local
}
is_item_from_trait: bool
This is set when trait items are completed in an impl of that trait.
is_item_from_notable_trait: bool
This is set for when trait items are from traits with #[doc(notable_trait)]
is_name_already_imported: bool
This is set when an import is suggested whose name is already imported.
requires_import: bool
This is set for completions that will insert a use
item.
is_op_method: bool
Set for method completions of the core::ops
and core::cmp
family.
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
is_definite: bool
This is set for type inference results
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
source§fn eq(&self, other: &CompletionRelevance) -> bool
fn eq(&self, other: &CompletionRelevance) -> bool
self
and other
values to be equal, and is used
by ==
.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
source§impl<T> Cast for T
impl<T> Cast for T
source§fn cast<U>(self, interner: <U as HasInterner>::Interner) -> Uwhere
Self: CastTo<U>,
U: HasInterner,
fn cast<U>(self, interner: <U as HasInterner>::Interner) -> Uwhere
Self: CastTo<U>,
U: HasInterner,
U
using CastTo
.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§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