pub trait EventEnum:
IntoBytes
+ Immutable
+ Copy {
const REPR: u8;
const LABELS: &'static [EnumLabel];
}Expand description
A Rust enum usable as an event field.
Implemented by #[derive(EventEnum)] on a fieldless #[repr(u8|u16|u32|u64)] enum. Instead of
hand-writing #[event(enum_labels(...))] on every field, you define the enum once with its
strong type and pass it around; a field of that type is automatically reflected as a
FieldType::Enum whose value→label map comes from
LABELS. The IntoBytes + Immutable bounds let the enum sit inline
in a #[repr(C)] event with no serialization.
ⓘ
use backbeat::EventEnum;
use backbeat::zerocopy::{Immutable, IntoBytes};
#[derive(EventEnum, IntoBytes, Immutable, Clone, Copy)]
#[repr(u8)]
enum Direction { Inbound = 0, Outbound = 1 }Required Associated Constants§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".