Skip to main content

EntityTagArith

Trait EntityTagArith 

Source
pub trait EntityTagArith: EntityTag { }
Expand description

Marker for tag types for which arithmetic makes sense.

struct RowTag;
type RowId = EntityIdU16<RowTag>;
impl EntityTag for RowTag {
    const PREFIX: &'static str = "X";
}
impl EntityTagArith for RowTag {}

let begin = RowId::from_idx(21);
let end = RowId::from_idx(37);
assert_eq!(end - begin, 16);
assert_eq!(begin + 16, end);

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§