Skip to main content

ForLt

Trait ForLt 

Source
pub trait ForLt {
    type Of<'a>: 'a;
}
Expand description

Representation of types generic over a lifetime.

§Macro

It is not recommended to implement this trait directly. ForLt! macro is provided to obtain a type that implements this trait.

The full syntax is

ForLt!(for<'a> TypeThatUse<'a>)

which gives a type so that <ForLt!(for<'a> TypeThatUse<'a>) as ForLt>::Of<'b> is TypeThatUse<'b>.

You may also use a short-hand syntax which works similar to lifetime elision. The macro also accepts types that do not involve a lifetime at all.

ForLt!(TypeThatUse<'_>) // Equivalent to `ForLt!(for<'a> TypeThatUse<'a>)`.
ForLt!(&u32) // Equivalent to `ForLt!(for<'a> &'a u32)`.
ForLt!(u32) // Equivalent to `ForLt!(for<'a> u32)`.

Required Associated Types§

Source

type Of<'a>: 'a

The type parameterized by the lifetime.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<const SIZE: usize> ForLt for Bar<'static, SIZE>

Source§

type Of<'a> = Bar<'a, SIZE>

Source§

impl<const SIZE: usize> ForLt for ExclusiveIoMem<'static, SIZE>

Source§

type Of<'a> = ExclusiveIoMem<'a, SIZE>

Source§

impl<const SIZE: usize> ForLt for IoMem<'static, SIZE>

Source§

type Of<'a> = IoMem<'a, SIZE>