Skip to content
Snippets Groups Projects
Commit c2e27eb6 authored by jackliu's avatar jackliu :disappointed:
Browse files

修正单词拼写错误

parent 17a98e22
No related branches found
No related tags found
No related merge requests found
......@@ -90,13 +90,13 @@ let next_dayTimeUtc = parsers::parser_timestampUtc("Day 05::00:00").unwrap();
**add ticker**
```rust
fn executer_task(id:u64) {
fn executor_task(id:u64) {
println!("on function mode:{}",chrono::Local::now().to_rfc2822());
}
// 使用函数方式执行代码 Use function to execute code
timer::spwan_ticker(time::Duration::from_millis(5000),2,executer_task);
timer::spawn_ticker(time::Duration::from_millis(5000),2,executor_task);
// 使用闭包模式 Use closure function
timer::spwan_ticker(time::Duration::from_millis(5000),2,|x| {
timer::spawn_ticker(time::Duration::from_millis(5000),2,|x| {
println!("on ticker:{}",chrono::Local::now().to_rfc2822());
});
```
......@@ -143,14 +143,14 @@ impl TaskAction for ExempleAction {
// 使用trait任务,可以简化部分实际逻辑
// Using trait tasks can simplify part of the actual logic
timer::spwan_trait(Arc::new(ExempleAction{}));
timer::spawn_trait(Arc::new(ExempleAction{}));
```
**add date**
```rust
timer::spwan_date("day 19:21:50",1,|id| {
timer::spawn_date("day 19:21:50",1,|id| {
println!("on date:{}",chrono::Local::now().to_rfc2822());
});
```
......
......@@ -156,24 +156,24 @@ pub mod timer {
/// use grapeTimerR::timer;
/// use std::time;
///
/// fn executer_task(id:u64) {
/// fn executor_task(id:u64) {
/// println!("on function mode:{}",chrono::Local::now().to_rfc2822());
/// }
/// // 使用函数方式执行代码 Use function to execute code
/// timer::spwan_ticker(time::Duration::from_millis(5000),2,executer_task);
/// timer::spawn_ticker(time::Duration::from_millis(5000),2,executor_task);
/// // 使用闭包模式 Use closure function
/// timer::spwan_ticker(time::Duration::from_millis(5000),2,|x| {
/// timer::spawn_ticker(time::Duration::from_millis(5000),2,|x| {
/// println!("on ticker:{}",chrono::Local::now().to_rfc2822());
/// });
/// ```
pub fn spwan_ticker(tick:time::Duration, loopCount:i32, f: impl Fn(u64) + Send+Sync + 'static) -> TResult<u64> {
pub fn spawn_trait(tick:time::Duration, loopCount:i32, f: impl Fn(u64) + Send+Sync + 'static) -> TResult<u64> {
let task_action = ClosuresAction::new("", next_uuid(), loopCount, tick, f);
let r = Inter.thread_pool.lock();
match r {
Err(e) => { Err(TError::new(TErrorKind::Other(e.to_string()))) },
Ok(mut v) => {
let task_id = task_action.id();
v.spwan(Arc::new(task_action));
v.spawn(Arc::new(task_action));
Ok(task_id)
}
}
......@@ -226,15 +226,15 @@ pub mod timer {
/// }
/// // 使用trait任务,可以简化部分实际逻辑
/// // Using trait tasks can simplify part of the actual logic
/// timer::spwan_trait(Arc::new(ExempleAction{}));
/// timer::spawn_trait(Arc::new(ExempleAction{}));
/// ```
pub fn spwan_trait(ft:Arc<dyn TaskAction>) -> TResult<u64> {
pub fn spawn_trait(ft:Arc<dyn TaskAction>) -> TResult<u64> {
let r = Inter.thread_pool.lock();
match r {
Err(e) => { Err(TError::new(TErrorKind::Other(e.to_string()))) },
Ok(mut v) => {
let taskId = ft.id();
v.spwan(ft);
v.spawn(ft);
Ok(taskId)
}
}
......@@ -246,18 +246,18 @@ pub mod timer {
///
/// ```
/// use grapeTimerR::timer;
/// timer::spwan_date("day 19:30:00",1,|id| {
/// timer::spawn_date("day 19:30:00",1,|id| {
/// println!("on date:{}",chrono::Local::now().to_rfc2822());
/// });
/// ```
pub fn spwan_date(dateformate:&str, loopCount:i32, f: impl Fn(u64) + Send+Sync + 'static) -> TResult<u64> {
pub fn spawn_date(dateformate:&str, loopCount:i32, f: impl Fn(u64) + Send+Sync + 'static) -> TResult<u64> {
let task_action = ClosuresAction::new(dateformate, next_uuid(), loopCount, time::Duration::from_secs(0), f);
let r = Inter.thread_pool.lock();
match r {
Err(e) => { Err(TError::new(TErrorKind::Other(e.to_string()))) },
Ok(mut v) => {
let task_id = task_action.id();
v.spwan(Arc::new(task_action));
v.spawn(Arc::new(task_action));
Ok(task_id)
}
}
......
......@@ -54,7 +54,7 @@ pub mod threads {
}
}
pub fn spwan(&self, t:Arc<dyn TaskAction>) {
pub fn spawn(&self, t:Arc<dyn TaskAction>) {
let task = t.clone();
let rx_spwan = self.stop_rx.clone();
let debug = self.debug;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment