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)
用于配置分层时间轮的参数。系统仅支持分层模式。 (Configuration parameters for hierarchical timing wheel. The system only supports hierarchical mode)
§示例 (Examples)
use kestrel_timer::WheelConfig;
use std::time::Duration;
// 使用默认配置(分层模式)
// (Use default configuration, hierarchical mode)
let config = WheelConfig::default();
// 使用 Builder 自定义配置
// (Use Builder to customize configuration)
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: DurationL0 层(底层)每个 tick 的时间长度 (Duration of each tick in L0 layer, bottom layer)
l0_slot_count: usizeL0 层槽位数量(必须是 2 的幂次方) (Number of slots in L0 layer, must be power of 2)
l1_tick_duration: DurationL1 层(高层)每个 tick 的时间长度 (Duration of each tick in L1 layer, upper layer)
l1_slot_count: usizeL1 层槽位数量(必须是 2 的幂次方) (Number of slots in L1 layer, must be power of 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