use crate::SupervisorConfig;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct ActorConfig {
channel_capacity: usize,
max_events_per_tick: usize,
}
impl ActorConfig {
#[must_use]
pub fn new(global_config: &SupervisorConfig) -> Self {
Self {
channel_capacity: global_config.default_actor_channel_capacity(),
max_events_per_tick: global_config.default_max_events_per_tick(),
}
}
#[must_use]
pub fn with_channel_capacity(mut self, channel_capacity: usize) -> Self {
self.channel_capacity = channel_capacity;
self
}
pub fn channel_capacity(&self) -> usize {
self.channel_capacity
}
#[must_use]
pub fn with_max_events_per_tick(mut self, max_events: usize) -> Self {
self.max_events_per_tick = max_events;
self
}
pub fn max_events_per_tick(&self) -> usize {
self.max_events_per_tick
}
}
impl Default for ActorConfig {
fn default() -> Self {
ActorConfig::new(&SupervisorConfig::default())
}
}