summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config.rs13
-rw-r--r--src/types/project.rs6
2 files changed, 7 insertions, 12 deletions
diff --git a/src/config.rs b/src/config.rs
index 98140e6..48e4323 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -6,8 +6,7 @@ use std::sync::Arc;
use iced_material::Theme;
use serde::{Deserialize, Serialize};
-use tokio_stream::StreamExt;
-use tokio_stream::wrappers::ReadDirStream;
+use smol::fs;
use crate::appearance::Appearance;
use crate::{Error, environment};
@@ -63,8 +62,6 @@ impl Config {
}
pub async fn load() -> Result<Self, Error> {
- use tokio::fs;
-
let path = Self::config_file_path();
if !path.try_exists()? {
Self::default()
@@ -94,7 +91,7 @@ impl Config {
pub async fn load_appearance(
theme_name: &str,
) -> Result<Appearance, Error> {
- use tokio::fs;
+ use smol::stream::StreamExt;
let read_entry = async move |entry: fs::DirEntry| {
let content = fs::read_to_string(entry.path()).await.ok()?;
@@ -113,8 +110,7 @@ impl Config {
selected = Theme::ALL[index].clone();
}
- let mut stream =
- ReadDirStream::new(fs::read_dir(Self::themes_dir()).await?);
+ let mut stream = fs::read_dir(Self::themes_dir()).await?;
while let Some(entry) = stream.next().await {
let Ok(entry) = entry else {
continue;
@@ -135,8 +131,7 @@ impl Config {
}
pub async fn save(self) -> Result<(), Error> {
- use tokio::fs;
- use tokio::io::AsyncWriteExt;
+ use smol::io::AsyncWriteExt;
let mut file = fs::File::create(Self::config_file_path()).await?;
diff --git a/src/types/project.rs b/src/types/project.rs
index aac9bca..a9c4430 100644
--- a/src/types/project.rs
+++ b/src/types/project.rs
@@ -1,5 +1,7 @@
use std::path::{Path, PathBuf};
+use smol::fs;
+
extern crate fxhash;
use iced::theme::{Base, Mode, Theme};
use rust_format::{Formatter, PostProcess, PrettyPlease};
@@ -39,7 +41,7 @@ impl Project {
}
pub async fn from_path(path: PathBuf) -> Result<(PathBuf, Self), Error> {
- let contents = tokio::fs::read_to_string(&path).await?;
+ let contents = fs::read_to_string(&path).await?;
let project: Self = serde_json::from_str(&contents)?;
Ok((path, project))
@@ -62,8 +64,6 @@ impl Project {
self,
path: Option<PathBuf>,
) -> Result<PathBuf, Error> {
- use tokio::fs;
-
let path = if let Some(p) = path {
if let Some(parent) = p.parent()
&& !parent.exists()