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>,
pub is_skipping_completion: bool,
}Fields§
§exact_name_match: boolThis 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>§is_local: boolSet 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: boolThis is set when an import is suggested in a use item whose name is already imported.
requires_import: boolThis is set for completions that will insert a use item.
is_private_editable: boolSet 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)
is_skipping_completion: booltrue when there is an await.method() or iter().method() completion.
Implementations§
Source§impl CompletionRelevance
impl CompletionRelevance
Sourceconst BASE_SCORE: u32 = 2_147_483_647u32
const BASE_SCORE: u32 = 2_147_483_647u32
Provides a relevance score. Higher values are more relevant.
The absolute value of the relevance score is not meaningful, for example a value of BASE_SCORE 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.
pub fn score(self) -> u32
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§impl UpmapFromRaFixture for CompletionRelevance
impl UpmapFromRaFixture for CompletionRelevance
fn upmap_from_ra_fixture( self, _analysis: &RaFixtureAnalysis, _virtual_file_id: FileId, _real_file_id: FileId, ) -> Result<Self, ()>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
§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<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
§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