pub struct WheelConfig {
pub l0_tick_duration: Duration,
pub l0_slot_count: usize,
pub l1_tick_duration: Duration,
pub l1_slot_count: usize,
}Expand description
Timing Wheel Configuration
Used to configure parameters for hierarchical timing wheel. The system only supports hierarchical mode.
§时间轮配置
用于配置分层时间轮的参数。系统只支持分层模式。
§Examples (示例)
use kestrel_timer::WheelConfig;
use std::time::Duration;
// Use default configuration (使用默认配置,分层模式)
let config = WheelConfig::default();
// Use Builder to customize configuration (使用 Builder 自定义配置)
let config = WheelConfig::builder()
.l0_tick_duration(Duration::from_millis(20))
.l0_slot_count(1024)
.l1_tick_duration(Duration::from_secs(2))
.l1_slot_count(128)
.build()
.unwrap();Fields§
§l0_tick_duration: DurationDuration of each tick in L0 layer, bottom layer
L0 层每个 tick 的持续时间
l0_slot_count: usizeNumber of slots in L0 layer, must be power of 2
L0 层槽位数,必须是 2 的幂
l1_tick_duration: DurationDuration of each tick in L1 layer, upper layer
L1 层每个 tick 的持续时间
l1_slot_count: usizeNumber of slots in L1 layer, must be power of 2
L1 层槽位数,必须是 2 的幂
Implementations§
Source§impl WheelConfig
impl WheelConfig
Sourcepub fn builder() -> WheelConfigBuilder
pub fn builder() -> WheelConfigBuilder
Create configuration builder (创建配置构建器)
Trait Implementations§
Source§impl Clone for WheelConfig
impl Clone for WheelConfig
Source§fn clone(&self) -> WheelConfig
fn clone(&self) -> WheelConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WheelConfig
impl Debug for WheelConfig
Auto Trait Implementations§
impl Freeze for WheelConfig
impl RefUnwindSafe for WheelConfig
impl Send for WheelConfig
impl Sync for WheelConfig
impl Unpin for WheelConfig
impl UnwindSafe for WheelConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more