spawn_blocking on pretty
This commit is contained in:
parent
ed87fd17ea
commit
c29a247284
@ -6,7 +6,7 @@ extern crate tokio;
|
||||
use async_zip::read::fs::ZipFileReader;
|
||||
use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
use tokio::fs;
|
||||
use tokio::{fs, task};
|
||||
use tokio::io::{AsyncBufReadExt, AsyncReadExt, AsyncWriteExt, BufReader};
|
||||
|
||||
const BASE_FILENAME: &str = "baza_utf8.zip";
|
||||
@ -234,7 +234,9 @@ async fn process_file(
|
||||
|
||||
// save json to file
|
||||
let new_data = parse_file(entry_reader).await?;
|
||||
let data_str = new_data.pretty(2);
|
||||
let data_str = task::spawn_blocking(move || {
|
||||
new_data.pretty(2)
|
||||
}).await?;
|
||||
|
||||
let mut outfile = fs::File::create(outfilename).await?;
|
||||
outfile.write_all(data_str.as_bytes()).await?;
|
||||
|
Loading…
Reference in New Issue
Block a user