pub trait MaybeResPath<'a>: Copy {
// Required method
fn opt_res_path(self) -> (Option<&'a Ty<'a>>, Option<&'a Path<'a>>);
// Provided methods
fn basic_res(self) -> &'a Res { ... }
fn res_local_id(self) -> Option<HirId> { ... }
fn res_local_id_and_ident(self) -> Option<(HirId, &'a Ident)> { ... }
}
Expand description
A HIR node which might be a QPath::Resolved
.
The following are resolved paths:
- A path to a module or crate item.
- A path to a trait item via the trait’s name.
- A path to a struct or variant constructor via the original type’s path.
- A local.
All other paths are TypeRelative
and require using PathRes
to lookup the
resolution.
Required Methods§
Provided Methods§
Sourcefn basic_res(self) -> &'a Res
fn basic_res(self) -> &'a Res
If this node is a resolved path gets it’s resolution. Returns Res::Err
otherwise.
Sourcefn res_local_id(self) -> Option<HirId>
fn res_local_id(self) -> Option<HirId>
If this node is a path to a local gets the local’s HirId
.
Sourcefn res_local_id_and_ident(self) -> Option<(HirId, &'a Ident)>
fn res_local_id_and_ident(self) -> Option<(HirId, &'a Ident)>
If this node is a path to a local gets the local’s HirId
and identifier.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.