Struct mononym::named::Life[][src]

pub struct Life<'name>(_);
Expand description

Turns a lifetime 'name into a unique type Life<'name> with an invariant phantom lifetime. Life implements Name so that it can be turned into a unique impl Name.

The body PhantomData has a phantom type *mut &'name () to ensure that overlapping lifetimes such as 'name1: 'name2 are treated as distinct types and cannot be coerced into one another, unless they are exactly the same.

For example, the following test should fail:

fn same<T>(_: T, _: T) {}
fn same_life<'name1, 'name2: 'name1>(
  life1: Life<'name1>,
  life2: Life<'name2>
) {
  same(life1, life2); // error
}

Trait Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.