Experiment with futures
This commit is contained in:
parent
907fbf95db
commit
2d3e3688fa
44 changed files with 2081 additions and 1242 deletions
|
|
@ -1,4 +1,5 @@
|
|||
use crate::symbols::Symbol;
|
||||
use async_trait::async_trait;
|
||||
use std::error::Error;
|
||||
use std::fs;
|
||||
use std::io;
|
||||
|
|
@ -15,8 +16,9 @@ impl<P> Dir<P> {
|
|||
}
|
||||
}
|
||||
|
||||
#[async_trait(?Send)]
|
||||
impl<P: AsRef<Path>> Symbol for Dir<P> {
|
||||
fn target_reached(&self) -> Result<bool, Box<dyn Error>> {
|
||||
async fn target_reached(&self) -> Result<bool, Box<dyn Error>> {
|
||||
if !self.path.as_ref().exists() {
|
||||
return Ok(false);
|
||||
}
|
||||
|
|
@ -30,7 +32,7 @@ impl<P: AsRef<Path>> Symbol for Dir<P> {
|
|||
Ok(true)
|
||||
}
|
||||
|
||||
fn execute(&self) -> Result<(), Box<dyn Error>> {
|
||||
async fn execute(&self) -> Result<(), Box<dyn Error>> {
|
||||
fs::create_dir(self.path.as_ref()).map_err(|e| Box::new(e) as Box<dyn Error>)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue