Trait stable_mir::crate_def::CrateDef
source · pub trait CrateDef {
// Required method
fn def_id(&self) -> DefId;
// Provided methods
fn name(&self) -> Symbol { ... }
fn trimmed_name(&self) -> Symbol { ... }
fn krate(&self) -> Crate { ... }
fn span(&self) -> Span { ... }
}
Expand description
A trait for retrieving information about a particular definition.
Implementors must provide the implementation of def_id
which will be used to retrieve
information about a crate’s definition.
Required Methods§
Provided Methods§
sourcefn trimmed_name(&self) -> Symbol
fn trimmed_name(&self) -> Symbol
Return a trimmed name of this definition.
This can be used to print more user friendly diagnostic messages.
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we trim its path and print only the name.
For example, this function may shorten std::vec::Vec
to just Vec
,
as long as there is no other Vec
importable anywhere.