From d6f5b3120c0a0b74445abedff4f116b5a601354c Mon Sep 17 00:00:00 2001 From: Nikita Galaiko Date: Tue, 16 May 2023 09:55:05 +0200 Subject: [PATCH] move reader writer to root --- src-tauri/src/app/deltas/reader.rs | 4 ++-- src-tauri/src/app/gb_repository/repository.rs | 5 ++--- src-tauri/src/app/mod.rs | 2 -- src-tauri/src/app/project_repository/repository.rs | 5 +---- src-tauri/src/app/sessions/iterator.rs | 2 +- src-tauri/src/app/sessions/reader.rs | 4 ++-- src-tauri/src/app/sessions/session.rs | 3 ++- src-tauri/src/app/sessions/writer.rs | 4 ++-- src-tauri/src/app/watcher/handlers/project_file_change.rs | 6 ++---- src-tauri/src/main.rs | 2 ++ src-tauri/src/{app => }/reader/mod.rs | 0 src-tauri/src/{app => }/reader/reader.rs | 0 src-tauri/src/{app => }/reader/reader_tests.rs | 0 src-tauri/src/{app => }/writer.rs | 0 14 files changed, 16 insertions(+), 21 deletions(-) rename src-tauri/src/{app => }/reader/mod.rs (100%) rename src-tauri/src/{app => }/reader/reader.rs (100%) rename src-tauri/src/{app => }/reader/reader_tests.rs (100%) rename src-tauri/src/{app => }/writer.rs (100%) diff --git a/src-tauri/src/app/deltas/reader.rs b/src-tauri/src/app/deltas/reader.rs index e0b6d861e..4afdc3c34 100644 --- a/src-tauri/src/app/deltas/reader.rs +++ b/src-tauri/src/app/deltas/reader.rs @@ -2,9 +2,9 @@ use std::{collections::HashMap, path}; use anyhow::Result; -use crate::app::{ +use crate::{ + app::sessions, reader::{self, Reader}, - sessions, }; use super::Delta; diff --git a/src-tauri/src/app/gb_repository/repository.rs b/src-tauri/src/app/gb_repository/repository.rs index 78a530185..04cf0937c 100644 --- a/src-tauri/src/app/gb_repository/repository.rs +++ b/src-tauri/src/app/gb_repository/repository.rs @@ -13,10 +13,9 @@ use uuid::Uuid; use crate::{fs, projects, users}; -use crate::app::{ - project_repository, +use crate::{ + app::{project_repository, sessions}, reader::{self, Reader}, - sessions, }; pub struct Repository { diff --git a/src-tauri/src/app/mod.rs b/src-tauri/src/app/mod.rs index ffdfdaaab..6c4c6446d 100644 --- a/src-tauri/src/app/mod.rs +++ b/src-tauri/src/app/mod.rs @@ -4,12 +4,10 @@ pub mod gb_repository; pub mod project_repository; pub mod projects; pub mod pty; -pub mod reader; pub mod search; pub mod sessions; pub mod users; pub mod watcher; -mod writer; pub use app::{AddProjectError, App}; pub use project_repository::FileStatus; diff --git a/src-tauri/src/app/project_repository/repository.rs b/src-tauri/src/app/project_repository/repository.rs index 538d67915..4d2da2d28 100644 --- a/src-tauri/src/app/project_repository/repository.rs +++ b/src-tauri/src/app/project_repository/repository.rs @@ -4,10 +4,7 @@ use anyhow::{Context, Result}; use serde::Serialize; use walkdir::WalkDir; -use crate::{ - app::{project_repository::activity, reader}, - projects, -}; +use crate::{app::project_repository::activity, projects, reader}; pub struct Repository<'repository> { pub(crate) git_repository: git2::Repository, diff --git a/src-tauri/src/app/sessions/iterator.rs b/src-tauri/src/app/sessions/iterator.rs index 72fb5f764..531358840 100644 --- a/src-tauri/src/app/sessions/iterator.rs +++ b/src-tauri/src/app/sessions/iterator.rs @@ -1,6 +1,6 @@ use anyhow::{Context, Result}; -use crate::app::reader::{CommitReader, Reader}; +use crate::reader::{CommitReader, Reader}; use super::{cache, Session, SessionError}; diff --git a/src-tauri/src/app/sessions/reader.rs b/src-tauri/src/app/sessions/reader.rs index c0b10aa53..88bef23eb 100644 --- a/src-tauri/src/app/sessions/reader.rs +++ b/src-tauri/src/app/sessions/reader.rs @@ -2,8 +2,8 @@ use std::collections::HashMap; use anyhow::{anyhow, Context, Result}; -use crate::app::{ - gb_repository, +use crate::{ + app::gb_repository, reader::{self, CommitReader, Reader}, }; diff --git a/src-tauri/src/app/sessions/session.rs b/src-tauri/src/app/sessions/session.rs index 7e3f440ff..cf1d5dece 100644 --- a/src-tauri/src/app/sessions/session.rs +++ b/src-tauri/src/app/sessions/session.rs @@ -1,8 +1,9 @@ -use crate::app::reader; use anyhow::{Context, Result}; use serde::Serialize; use thiserror::Error; +use crate::reader; + #[derive(Debug, Clone, Serialize, PartialEq)] #[serde(rename_all = "camelCase")] pub struct Meta { diff --git a/src-tauri/src/app/sessions/writer.rs b/src-tauri/src/app/sessions/writer.rs index 59dbfab9d..f049b8c12 100644 --- a/src-tauri/src/app/sessions/writer.rs +++ b/src-tauri/src/app/sessions/writer.rs @@ -2,8 +2,8 @@ use std::time; use anyhow::{anyhow, Context, Result}; -use crate::app::{ - deltas, gb_repository, pty, +use crate::{ + app::{deltas, gb_repository, pty}, reader::{self, Reader}, writer::{self, Writer}, }; diff --git a/src-tauri/src/app/watcher/handlers/project_file_change.rs b/src-tauri/src/app/watcher/handlers/project_file_change.rs index 95a779439..5bfc299ea 100644 --- a/src-tauri/src/app/watcher/handlers/project_file_change.rs +++ b/src-tauri/src/app/watcher/handlers/project_file_change.rs @@ -3,11 +3,9 @@ use std::vec; use anyhow::{Context, Result}; use crate::{ - app::{ - deltas, gb_repository, project_repository, - reader::{self, Reader}, - }, + app::{deltas, gb_repository, project_repository}, projects, + reader::{self, Reader}, }; use super::events; diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 2ca74f474..997d9a789 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -4,6 +4,8 @@ extern crate scopeguard; extern crate lazy_static; mod app; +mod reader; +mod writer; mod zip; mod events; mod fs; diff --git a/src-tauri/src/app/reader/mod.rs b/src-tauri/src/reader/mod.rs similarity index 100% rename from src-tauri/src/app/reader/mod.rs rename to src-tauri/src/reader/mod.rs diff --git a/src-tauri/src/app/reader/reader.rs b/src-tauri/src/reader/reader.rs similarity index 100% rename from src-tauri/src/app/reader/reader.rs rename to src-tauri/src/reader/reader.rs diff --git a/src-tauri/src/app/reader/reader_tests.rs b/src-tauri/src/reader/reader_tests.rs similarity index 100% rename from src-tauri/src/app/reader/reader_tests.rs rename to src-tauri/src/reader/reader_tests.rs diff --git a/src-tauri/src/app/writer.rs b/src-tauri/src/writer.rs similarity index 100% rename from src-tauri/src/app/writer.rs rename to src-tauri/src/writer.rs