Crate genz

Source
Expand description

Uniqueness of types via invariant lifetimes.

Provides a UniqueType marker which makes it impossible to call the following without resorting to unsafe code:

fn same_type<'c, T>(t1: UniqueType<'c, T>, t2: UniqueType<'c, T>)
{
  panic!("this is impossible!")
}

Structs§

Gen
A structure for storing values containing unique types.
Region
An invariant lifetime marker.
Scope
A covariant lifetime marker.
UniqueType
A marker for a type which is guaranteed to be unique within some region of code.

Traits§

StaticTuple
A trait implemented by tuples of static types.
Storable
The trait of values containing unique types which may be stored.
TryGenTuple
A trait for creating a tuples of unique type markers.

Functions§

try_with_types
Attempt to invoke f with an invariant lifetime marker and a tuple of type markers that are unique for that lifetime.
with_region
Invoke f with an invariant lifetime marker.
with_scope
Invoke f with an covariant lifetime marker.
with_type
Invoke f with a type marker which is unique for an invariant lifetime.
with_types
Like try_with_types, but it unwraps for you.