pub trait MaybeQPath<'a>: Copy {
// Required method
fn opt_qpath(self) -> Option<(&'a QPath<'a>, HirId)>;
// Provided methods
fn opt_lang_path(self) -> Option<LangItem> { ... }
fn res<'tcx>(self, typeck: &impl MaybeTypeckRes<'tcx>) -> Res { ... }
fn res_if_named<'tcx>(
self,
typeck: &impl MaybeTypeckRes<'tcx>,
name: Symbol,
) -> Res { ... }
fn res_with_seg<'tcx>(
self,
typeck: &impl MaybeTypeckRes<'tcx>,
) -> (Res, Option<&'a PathSegment<'a>>) { ... }
fn typeless_res<'tcx>(self, typeck: &impl MaybeTypeckRes<'tcx>) -> Res { ... }
fn typeless_res_if_named<'tcx>(
self,
typeck: &impl MaybeTypeckRes<'tcx>,
name: Symbol,
) -> Res { ... }
fn ty_rel_def<'tcx>(
self,
typeck: &impl MaybeTypeckRes<'tcx>,
) -> Option<(DefKind, DefId)> { ... }
fn ty_rel_def_if_named<'tcx>(
self,
typeck: &impl MaybeTypeckRes<'tcx>,
name: Symbol,
) -> Option<(DefKind, DefId)> { ... }
fn ty_rel_def_with_seg<'tcx>(
self,
typeck: &impl MaybeTypeckRes<'tcx>,
) -> Option<((DefKind, DefId), &'a PathSegment<'a>)> { ... }
}
Expand description
A HIR node which might be a QPath
.
Required Methods§
Provided Methods§
Sourcefn opt_lang_path(self) -> Option<LangItem>
fn opt_lang_path(self) -> Option<LangItem>
If this node is a QPath::LangItem
gets the item it resolves to.
Sourcefn res<'tcx>(self, typeck: &impl MaybeTypeckRes<'tcx>) -> Res
fn res<'tcx>(self, typeck: &impl MaybeTypeckRes<'tcx>) -> Res
If this is a path gets its resolution. Returns Res::Err
otherwise.
Sourcefn res_if_named<'tcx>(
self,
typeck: &impl MaybeTypeckRes<'tcx>,
name: Symbol,
) -> Res
fn res_if_named<'tcx>( self, typeck: &impl MaybeTypeckRes<'tcx>, name: Symbol, ) -> Res
If this is a path with the specified name as its final segment gets its
resolution. Returns Res::Err
otherwise.
Sourcefn res_with_seg<'tcx>(
self,
typeck: &impl MaybeTypeckRes<'tcx>,
) -> (Res, Option<&'a PathSegment<'a>>)
fn res_with_seg<'tcx>( self, typeck: &impl MaybeTypeckRes<'tcx>, ) -> (Res, Option<&'a PathSegment<'a>>)
If this is a path gets both its resolution and final segment.
Sourcefn typeless_res<'tcx>(self, typeck: &impl MaybeTypeckRes<'tcx>) -> Res
fn typeless_res<'tcx>(self, typeck: &impl MaybeTypeckRes<'tcx>) -> Res
If this is a path without an explicit Self
type gets its resolution.
Returns Res::Err
otherwise.
Only paths to trait items can optionally contain a Self
type.
Sourcefn typeless_res_if_named<'tcx>(
self,
typeck: &impl MaybeTypeckRes<'tcx>,
name: Symbol,
) -> Res
fn typeless_res_if_named<'tcx>( self, typeck: &impl MaybeTypeckRes<'tcx>, name: Symbol, ) -> Res
If this is a path without an explicit Self
type to an item with the
specified name gets its resolution. Returns Res::Err
otherwise.
Only paths to trait items can optionally contain a Self
type.
Sourcefn ty_rel_def<'tcx>(
self,
typeck: &impl MaybeTypeckRes<'tcx>,
) -> Option<(DefKind, DefId)>
fn ty_rel_def<'tcx>( self, typeck: &impl MaybeTypeckRes<'tcx>, ) -> Option<(DefKind, DefId)>
If this is a type-relative path gets the definition it resolves to.
Only inherent associated items require a type-relative path.
Sourcefn ty_rel_def_if_named<'tcx>(
self,
typeck: &impl MaybeTypeckRes<'tcx>,
name: Symbol,
) -> Option<(DefKind, DefId)>
fn ty_rel_def_if_named<'tcx>( self, typeck: &impl MaybeTypeckRes<'tcx>, name: Symbol, ) -> Option<(DefKind, DefId)>
If this is a type-relative path to an item with the specified name gets the definition it resolves to.
Only inherent associated items require a type-relative path.
Sourcefn ty_rel_def_with_seg<'tcx>(
self,
typeck: &impl MaybeTypeckRes<'tcx>,
) -> Option<((DefKind, DefId), &'a PathSegment<'a>)>
fn ty_rel_def_with_seg<'tcx>( self, typeck: &impl MaybeTypeckRes<'tcx>, ) -> Option<((DefKind, DefId), &'a PathSegment<'a>)>
If this is a type-relative path gets the definition it resolves to and its final segment.
Only inherent associated items require a type-relative path.
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.