pub struct CompletionRelevance {
    pub exact_name_match: bool,
    pub type_match: Option<CompletionRelevanceTypeMatch>,
    pub is_local: bool,
    pub is_op_method: bool,
    pub is_private_editable: bool,
    pub exact_postfix_snippet_match: bool,
}

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_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.

exact_postfix_snippet_match: bool

This is set in cases like these:

(a > b).not$0

Basically, we want to guarantee that postfix snippets always takes precedence over everything else.

Implementations

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.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Cast a value to type U using CastTo.

Compare self to key and return true if they are equal.

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more