diplomat_core::ast::lifetimes

Struct LifetimeTransitivity

source
pub struct LifetimeTransitivity<'env> {
    env: &'env LifetimeEnv,
    visited: Vec<bool>,
    out: Vec<&'env NamedLifetime>,
    longer_or_shorter: LongerOrShorter,
}
Expand description

Collect all lifetimes that are either longer_or_shorter

Fields§

§env: &'env LifetimeEnv§visited: Vec<bool>§out: Vec<&'env NamedLifetime>§longer_or_shorter: LongerOrShorter

Implementations§

source§

impl<'env> LifetimeTransitivity<'env>

source

pub fn longer(env: &'env LifetimeEnv) -> Self

Returns a new LifetimeTransitivity that finds all longer lifetimes.

source

pub fn shorter(env: &'env LifetimeEnv) -> Self

Returns a new LifetimeTransitivity that finds all shorter lifetimes.

source

pub fn longer_than( env: &'env LifetimeEnv, named: &NamedLifetime, ) -> Vec<&'env NamedLifetime>

Returns all the lifetimes longer than a provided NamedLifetime.

source

pub fn shorter_than( env: &'env LifetimeEnv, named: &NamedLifetime, ) -> Vec<&'env NamedLifetime>

Returns all the lifetimes shorter than the provided NamedLifetime.

source

fn new(env: &'env LifetimeEnv, longer_or_shorter: LongerOrShorter) -> Self

Returns a new LifetimeTransitivity.

source

pub fn visit(&mut self, named: &NamedLifetime)

Visits a lifetime, as well as all the nodes it’s transitively longer or shorter than, depending on how the LifetimeTransitivity was constructed.

source

fn dfs(&mut self, index: usize)

Performs depth-first search through the LifetimeEnv created at construction for all nodes longer or shorter than the node at the provided index, depending on how the LifetimeTransitivity was constructed.

source

pub fn finish(self) -> Vec<&'env NamedLifetime>

Returns the transitively reachable lifetimes.

Auto Trait Implementations§

§

impl<'env> Freeze for LifetimeTransitivity<'env>

§

impl<'env> RefUnwindSafe for LifetimeTransitivity<'env>

§

impl<'env> Send for LifetimeTransitivity<'env>

§

impl<'env> Sync for LifetimeTransitivity<'env>

§

impl<'env> Unpin for LifetimeTransitivity<'env>

§

impl<'env> UnwindSafe for LifetimeTransitivity<'env>

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>,

source§

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>,

source§

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.