pub mod bit_set;
pub mod counting_bit_set;
use core::fmt::Debug;
use iceoryx2_bb_elementary_traits::relocatable_container::RelocatableContainer;
use iceoryx2_bb_elementary_traits::zero_copy_send::ZeroCopySend;
use crate::event::EventId;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct EventActivation {
pub id: EventId,
pub count: u64,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum EventStateActivateError {
EventIdOutOfBounds,
}
impl core::fmt::Display for EventStateActivateError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "EventStateActivateError::{self:?}")
}
}
impl core::error::Error for EventStateActivateError {}
pub trait EventState: Sized + Send + Sync + Debug + ZeroCopySend + RelocatableContainer {
fn max_event_count(&self) -> u64;
fn max_event_id(&self) -> EventId;
fn activate(&self, event_id: EventId) -> Result<(), EventStateActivateError>;
fn drain<F: FnMut(EventActivation)>(&self, callback: &mut F) -> u64;
}