puniyu_types 0.6.0

puniyu 通用类型库
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::event::Event;

pub trait Matcher: Send + Sync + 'static {
	/// 匹配结果类型
	type MatchResult;

	/// 获取匹配器名称
	fn name(&self) -> &str;

	/// 获取匹配器优先级
	fn rank(&self) -> u8 {
		5
	}

	/// 匹配事件,返回匹配结果
	fn matches(&self, event: &Event) -> Option<Self::MatchResult>;
}