pub struct PathCastCache<'tcx> { /* private fields */ }
Expand description

Manage the type cast for paths

Implementations§

source§

impl<'tcx> PathCastCache<'tcx>

source

pub fn new() -> PathCastCache<'tcx>

source

pub fn get_cast_types(&self, path: &Rc<Path>) -> Option<&HashSet<Ty<'tcx>>>

Returns the types that a path may be cast to

source

pub fn cast_to( &mut self, acx: &mut AnalysisContext<'tcx, '_>, path: &Rc<Path>, ty: Ty<'tcx> ) -> Option<Rc<Path>>

Creates a path that casts the given path to a given type

source

pub fn get_type_variant( &mut self, acx: &mut AnalysisContext<'tcx, '_>, path: &Rc<Path>, ty: Ty<'tcx> ) -> Option<Rc<Path>>

source

pub fn get_regularized_path( acx: &mut AnalysisContext<'tcx, '_>, path: Rc<Path> ) -> Rc<Path>

Different paths may refer to the same memory location, we can regularize these path to a base path e.g. a.0.0, a.0, a.cast#T’ and a are all represented by one path

Trait Implementations§

source§

impl<'tcx> Default for PathCastCache<'tcx>

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'tcx> !RefUnwindSafe for PathCastCache<'tcx>

§

impl<'tcx> !Send for PathCastCache<'tcx>

§

impl<'tcx> !Sync for PathCastCache<'tcx>

§

impl<'tcx> Unpin for PathCastCache<'tcx>

§

impl<'tcx> !UnwindSafe for PathCastCache<'tcx>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.