paralegal_flow::utils

Trait TyExt

Source
pub trait TyExt: Sized {
    // Required method
    fn defid_ref(&self) -> Option<&DefId>;

    // Provided method
    fn defid(self) -> Option<DefId> { ... }
}
Expand description

Extension trait for ty::Ty. This lets us implement methods on ty::Ty. Self is only ever supposed to be instantiated as ty::Ty.

Required Methods§

Provided Methods§

Source

fn defid(self) -> Option<DefId>

Extract a DefId if this type references an object that has one. This is true for most user defined types, including types form the standard library, but not builtin types, such as u32, arrays or ad-hoc types such as function pointers.

Use with caution, this function might not be exhaustive (yet).

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.

Implementations on Foreign Types§

Source§

impl TyExt for Ty<'_>

Implementors§