pub struct MemorySerialBackend { /* private fields */ }Expand description
Implementations§
Source§impl MemorySerialBackend
impl MemorySerialBackend
Sourcepub fn with_max_records(self, max: usize) -> Self
pub fn with_max_records(self, max: usize) -> Self
设置最大记录数
Trait Implementations§
Source§impl Default for MemorySerialBackend
impl Default for MemorySerialBackend
Source§impl SerialGenerator for MemorySerialBackend
impl SerialGenerator for MemorySerialBackend
Source§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 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,
生成下一个单号
Source§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 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,
批量生成单号
Source§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 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,
预览下一个单号(不消耗计数器)
Source§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 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,
运行时注册/更新一条规则
Source§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 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,
运行时删除一条规则
Source§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 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,
运行时启用一条规则
Source§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 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,
运行时禁用一条规则
Source§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 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,
查询生成记录(分页),返回 (记录列表, 总数)
Source§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,
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,
获取所有已注册的规则
Auto Trait Implementations§
impl !Freeze for MemorySerialBackend
impl !RefUnwindSafe for MemorySerialBackend
impl !UnwindSafe for MemorySerialBackend
impl Send for MemorySerialBackend
impl Sync for MemorySerialBackend
impl Unpin for MemorySerialBackend
impl UnsafeUnpin for MemorySerialBackend
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