Skip to main content

IndexedId

Trait IndexedId 

Source
pub trait IndexedId: Copy {
    const COUNT: usize;

    // Required methods
    unsafe fn from_index_release_unchecked(index: usize) -> Self;
    fn to_index(self) -> usize;
}
Expand description

A trait for property-id-like types that can be stored compactly in an IdSet bitfield.

Required Associated Constants§

Source

const COUNT: usize

The number of distinct ids, i.e. the number of bits the set needs.

Required Methods§

Source

unsafe fn from_index_release_unchecked(index: usize) -> Self

Builds an id from its index in the set. The caller must guarantee that index < Self::COUNT.

Source

fn to_index(self) -> usize

Returns the index of this id in the set.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl IndexedId for LonghandId

Source§

const COUNT: usize = property_counts::LONGHANDS

Source§

impl IndexedId for PrioritaryPropertyId

Source§

const COUNT: usize = property_counts::PRIORITARY

Source§

impl IndexedId for NonCustomPropertyId

Source§

const COUNT: usize = property_counts::NON_CUSTOM