def_to_moniker

Function def_to_moniker 

Source
pub(crate) fn def_to_moniker(
    db: &RootDatabase,
    definition: Definition,
    from_crate: Crate,
) -> Option<MonikerResult>
Expand description

Computes a MonikerResult for a definition. Result cases:

  • Some(MonikerResult::Moniker(_)) provides a unique Moniker which refers to a definition.

  • Some(MonikerResult::Local { .. }) provides a Moniker for the definition enclosing a local.

  • None is returned for definitions which are not in a module: BuiltinAttr, BuiltinType, BuiltinLifetime, TupleField, ToolModule, and InlineAsmRegOrRegClass. TODO: it might be sensible to provide monikers that refer to some non-existent crate of compiler builtin definitions.