pub trait Serial {
type Data;
type Iter<'a>: Iterator<Item = (u32, &'a Self::Data)>
where Self: 'a,
Self::Data: 'a;
// Required methods
fn next_serial(&mut self, data: Self::Data) -> u32;
fn get(&self, serial: u32) -> Option<&Self::Data>;
fn iter(&self) -> Self::Iter<'_>;
fn expire(&mut self, serial: u32) -> bool;
}
Expand description
Event serial management. (WIP, not currently used)
This trait allocates serial numbers, while keeping track of allocated numbers and their associated data.
Some expiration scheme might be employed by the implementation to free up old serial numbers.
TODO: this is incomplete and not used.
Required Associated Types§
type Data
type Iter<'a>: Iterator<Item = (u32, &'a Self::Data)> where Self: 'a, Self::Data: 'a
Required Methods§
sourcefn next_serial(&mut self, data: Self::Data) -> u32
fn next_serial(&mut self, data: Self::Data) -> u32
Get the next serial number in sequence. A piece of data can be attached to each serial, storing, for example, what this event is about.
sourcefn get(&self, serial: u32) -> Option<&Self::Data>
fn get(&self, serial: u32) -> Option<&Self::Data>
Get the data associated with the given serial.