Skip to main content

Module handler

Module handler 

Source
Expand description

handler 注册表:RwLock<精确表 + general 表>,HandlerId 去重。

原版差异:

  • 原版 defaultdict(list) + list[handler](对象相等去重)在 Rust 不可复刻(闭包不可比), 改为注册时分配自增 HandlerId,上层可保存 id 用于注销。
  • 全程 RwLock 保护(原版无锁靠 GIL,这里修正)。

Structs§

HandlerId
注册标识;unregister 凭它定位。
HandlerRegistry
handler 注册管理器。线程安全。(含不透明函数对象,不 derive Debug)

Type Aliases§

HandlerFn
handler 函数签名(与原版 Callable[[Event], None] 对齐)。