Trait index_ext::tag::Tag

source ·
pub unsafe trait Tag: Copy { }
Expand description

A type suitable for tagging length, indices, and containers.

Safety

The manner in which new ExactSize instances of types implementing this trait can be created is an invariant of each individual type. It must not be allowed to subvert the invariants imposed by any other type implementing this trait. In particular you mustn’t create an instance that allows coercing a ExactSize<ATag> into ExactSize<BTag> where you don’t control both these types. Note that this restriction MUST hold for every possible coercion allowed by the language. There are no inherently safe constructors for ExactSize but each tag type might define some.

The type must further promise to be zero-sized and have an alignment of exactly 1. This allows tags to be virtually added to other referenced objects in-place.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Tag for Generative<'_>

SAFETY: This is invariant over the lifetime. There are no other coercions. See https://doc.rust-lang.org/nomicon/coercions.html#coercions

source§

impl<T> Tag for TagNamed<T>

source§

impl<T: ConstantSource> Tag for Constant<T>

source§

impl<const N: usize> Tag for Const<N>