| Crates.io | puniyu_matcher |
| lib.rs | puniyu_matcher |
| version | 0.4.1 |
| created_at | 2025-10-24 16:28:43.705048+00 |
| updated_at | 2025-11-16 07:32:23.019272+00 |
| description | puniyu 的事件匹配器模块 |
| homepage | https://github.com/puniyu/puniyu |
| repository | https://github.com/puniyu/puniyu |
| max_upload_size | |
| id | 1898752 |
| size | 74,067 |
事件匹配器模块
puniyu_matcher 是 puniyu 项目中负责事件匹配的核心库。它提供了统一的事件匹配器接口、消息事件匹配实现以及匹配器注册和管理机制。
事件匹配器基础 trait,所有事件匹配器都需要实现此 trait:
matches(): 匹配事件的方法,返回布尔值name(): 返回匹配器名称rank(): 返回匹配器优先级(默认值为 5,数值越小优先级越高)消息事件匹配器实现:
匹配器注册表,提供匹配器的注册和管理功能:
register(): 注册匹配器unregister(): 卸载匹配器get_all(): 获取所有匹配器get_with_name(): 根据名称获取匹配器底层存储实现:
RwLock<Vec<Arc<dyn Matcher>>> 存储匹配器Arc 和 RwLock 确保线程安全本项目采用 LGPL 许可证。