Module rust_examples::brands [−][src]
Expand description
This module demonstrates branded types on an example of a Vec with unchecked-indexing.
The concept of unchecked-indexing means that the API of this vector is constructed in such a way that index bounds check is performed statically at compile time. This is achieved via lifetimes and there is no cost at runtime.
The example is taken from the GhostCell paper.
Structs
Thin wrapper for usize which is bound to particular instance of a BrandedVec via 'id and
serves as an access token to the interior values.
Thin wrapper for Vec which can only be accessed via an associated BrandedIndex
Lifetime wrapper which makes 'id invariant and has no size.
