From 08d1adf44e452a4663afc7638db4d4a90fccd19e Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Thu, 19 Feb 2026 16:10:28 -0600 Subject: [PATCH] feat(io): add method to just load file async --- src/io.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/io.rs b/src/io.rs index 4466df9..16b421d 100644 --- a/src/io.rs +++ b/src/io.rs @@ -43,3 +43,12 @@ pub async fn save_file(path: Option, text: String) -> Result Err(err), } } + +pub async fn load_file(path: PathBuf) -> Result<(PathBuf, String), String> { + let content_result = fs::read_to_string(&path).await.map_err(|e| e.to_string()); + + match content_result { + Ok(content) => Ok((path, content)), + Err(e) => Err(e), + } +}