pub struct WheelConfig {
pub tick_duration: Duration,
pub slot_count: usize,
}Expand description
时间轮配置
用于配置时间轮的基本参数,包括 tick 时长和槽位数量。
§示例
use kestrel_protocol_timer::WheelConfig;
use std::time::Duration;
// 使用默认配置
let config = WheelConfig::default();
// 使用 Builder 自定义配置
let config = WheelConfig::builder()
.tick_duration(Duration::from_millis(20))
.slot_count(1024)
.build()
.unwrap();Fields§
§tick_duration: Duration每个 tick 的时间长度
slot_count: usize槽位数量(必须是 2 的幂次方)
Implementations§
Source§impl WheelConfig
impl WheelConfig
Sourcepub fn builder() -> WheelConfigBuilder
pub fn builder() -> WheelConfigBuilder
创建配置构建器
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