use std::{thread, time}; use uiuifree_text_data::CsvTokenizer; #[tokio::test] async fn test() { println!("hoge"); let csv = CsvTokenizer::new("./tests/test.csv").process(|row| async move { thread::sleep(time::Duration::from_millis(row[1].parse().unwrap())); Hoge { data: row[0].to_string() } }).await; println!("{:?}",csv); let csv = CsvTokenizer::new("./tests/test.csv"); assert!(csv.headers().is_ok()); assert!(csv.headers().is_ok()); } #[tokio::test] async fn test2() { println!("hoge"); let csv = CsvTokenizer::new("./tests/test.csv").process2(|row| async move { thread::sleep(time::Duration::from_millis(row[1].parse().unwrap())); Hoge { data: row[0].to_string() } }).await; println!("{:?}",csv); let mut csv = CsvTokenizer::new("./tests/test.csv"); assert!(csv.headers().is_ok()); assert!(csv.headers().is_ok()); } #[derive(Debug,Clone)] struct Hoge { data: String, }