pub struct WheelConfig { /* private fields */ }Expand description
Timing Wheel Configuration
Used to configure parameters for hierarchical timing wheel. The system only supports hierarchical mode.
§时间轮配置
用于配置分层时间轮的参数。系统只支持分层模式。
§Examples (示例)
use kestrel_timer::config::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();Implementations§
Source§impl WheelConfig
impl WheelConfig
Sourcepub fn builder() -> WheelConfigBuilder
pub fn builder() -> WheelConfigBuilder
Create configuration builder (创建配置构建器)
Sourcepub fn l0_tick_duration(&self) -> Duration
pub fn l0_tick_duration(&self) -> Duration
Get the L0 tick duration.
Sourcepub fn l0_slot_count(&self) -> usize
pub fn l0_slot_count(&self) -> usize
Get the L0 slot count.
Sourcepub fn l1_tick_duration(&self) -> Duration
pub fn l1_tick_duration(&self) -> Duration
Get the L1 tick duration.
Sourcepub fn l1_slot_count(&self) -> usize
pub fn l1_slot_count(&self) -> usize
Get the L1 slot count.
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 (const: unstable) · 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 UnsafeUnpin 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