pub trait SerialGenerator: Send + Sync {
// Required methods
fn generate<'life0, 'life1, 'async_trait>(
&'life0 self,
rule_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, SerialError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn batch_generate<'life0, 'life1, 'async_trait>(
&'life0 self,
rule_key: &'life1 str,
count: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, SerialError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn peek<'life0, 'life1, 'async_trait>(
&'life0 self,
rule_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, SerialError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn register_rule<'life0, 'async_trait>(
&'life0 self,
rule: SerialRule,
) -> Pin<Box<dyn Future<Output = Result<(), SerialError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn remove_rule<'life0, 'life1, 'async_trait>(
&'life0 self,
rule_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), SerialError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn enable_rule<'life0, 'life1, 'async_trait>(
&'life0 self,
rule_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), SerialError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn disable_rule<'life0, 'life1, 'async_trait>(
&'life0 self,
rule_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), SerialError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn query_records<'life0, 'life1, 'async_trait>(
&'life0 self,
rule_key: &'life1 str,
page: u64,
page_size: u64,
) -> Pin<Box<dyn Future<Output = Result<(Vec<SerialRecord>, u64), SerialError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn list_rules<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<SerialRule>, SerialError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Required Methods§
Sourcefn generate<'life0, 'life1, 'async_trait>(
&'life0 self,
rule_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, SerialError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn generate<'life0, 'life1, 'async_trait>(
&'life0 self,
rule_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, SerialError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
生成下一个单号
Sourcefn batch_generate<'life0, 'life1, 'async_trait>(
&'life0 self,
rule_key: &'life1 str,
count: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, SerialError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn batch_generate<'life0, 'life1, 'async_trait>(
&'life0 self,
rule_key: &'life1 str,
count: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, SerialError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
批量生成单号
Sourcefn peek<'life0, 'life1, 'async_trait>(
&'life0 self,
rule_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, SerialError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn peek<'life0, 'life1, 'async_trait>(
&'life0 self,
rule_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, SerialError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
预览下一个单号(不消耗计数器)
Sourcefn register_rule<'life0, 'async_trait>(
&'life0 self,
rule: SerialRule,
) -> Pin<Box<dyn Future<Output = Result<(), SerialError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn register_rule<'life0, 'async_trait>(
&'life0 self,
rule: SerialRule,
) -> Pin<Box<dyn Future<Output = Result<(), SerialError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
运行时注册/更新一条规则
Sourcefn remove_rule<'life0, 'life1, 'async_trait>(
&'life0 self,
rule_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), SerialError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove_rule<'life0, 'life1, 'async_trait>(
&'life0 self,
rule_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), SerialError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
运行时删除一条规则
Sourcefn enable_rule<'life0, 'life1, 'async_trait>(
&'life0 self,
rule_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), SerialError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn enable_rule<'life0, 'life1, 'async_trait>(
&'life0 self,
rule_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), SerialError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
运行时启用一条规则
Sourcefn disable_rule<'life0, 'life1, 'async_trait>(
&'life0 self,
rule_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), SerialError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn disable_rule<'life0, 'life1, 'async_trait>(
&'life0 self,
rule_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), SerialError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
运行时禁用一条规则
Sourcefn query_records<'life0, 'life1, 'async_trait>(
&'life0 self,
rule_key: &'life1 str,
page: u64,
page_size: u64,
) -> Pin<Box<dyn Future<Output = Result<(Vec<SerialRecord>, u64), SerialError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn query_records<'life0, 'life1, 'async_trait>(
&'life0 self,
rule_key: &'life1 str,
page: u64,
page_size: u64,
) -> Pin<Box<dyn Future<Output = Result<(Vec<SerialRecord>, u64), SerialError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
查询生成记录(分页),返回 (记录列表, 总数)
Sourcefn list_rules<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<SerialRule>, SerialError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_rules<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<SerialRule>, SerialError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
获取所有已注册的规则
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".