summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock1
-rw-r--r--Cargo.toml1
-rw-r--r--src/lib.rs25
-rw-r--r--systems/_asset/src/rw.rs5
-rw-r--r--systems/_asset/test/src/lib.rs2
-rw-r--r--systems/_framework/src/lib.rs7
-rw-r--r--systems/sheet/src/sheet.rs10
-rw-r--r--systems/vault/src/vault.rs2
-rw-r--r--systems/vault/src/vault/config.rs10
-rw-r--r--systems/workspace/src/workspace.rs2
-rw-r--r--systems/workspace/src/workspace/config.rs10
11 files changed, 40 insertions, 35 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 99f68cd..cf651ce 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -988,6 +988,7 @@ dependencies = [
"constants",
"criterion",
"data_struct",
+ "framework",
"hex_display",
"jvlib",
"sha1_hash",
diff --git a/Cargo.toml b/Cargo.toml
index 20d97d4..8118e7d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -129,6 +129,7 @@ tcp_connection = { path = "utils/tcp_connection" }
asset_system = { path = "systems/_asset" }
config_system = { path = "systems/_config" }
constants = { path = "systems/_constants" }
+framework = { path = "systems/_framework" }
sheet_system = { path = "systems/sheet" }
vault_system = { path = "systems/vault" }
workspace_system = { path = "systems/workspace" }
diff --git a/src/lib.rs b/src/lib.rs
index 5609c2e..bd3f9ef 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -16,10 +16,6 @@ pub mod lib {
#[cfg(feature = "lib")]
pub mod system {
- pub mod constants {
- pub use constants::*;
- }
-
pub mod asset_system {
pub use asset_system::*;
}
@@ -32,8 +28,25 @@ pub mod system {
pub use sheet_system::*;
}
- pub mod storage_system {
- pub use storage_system::*;
+ pub mod config_system {
+ pub use config_system::*;
+ }
+
+ pub mod constants {
+ pub use constants::*;
+ }
+
+ pub mod space {
+ pub use framework::space::*;
+ pub use framework::space_macro::*;
+ }
+
+ pub mod workspace {
+ pub use workspace_system::*;
+ }
+
+ pub mod vault {
+ pub use vault_system::*;
}
}
diff --git a/systems/_asset/src/rw.rs b/systems/_asset/src/rw.rs
index 784d44d..9a46144 100644
--- a/systems/_asset/src/rw.rs
+++ b/systems/_asset/src/rw.rs
@@ -3,8 +3,6 @@ use std::path::PathBuf;
use crate::error::{DataReadError, DataWriteError};
pub trait RWData<DataType> {
- type DataType;
-
/// Implement read logic
/// Given a path, return the specific data
fn read(path: &PathBuf) -> impl Future<Output = Result<DataType, DataReadError>> + Send + Sync;
@@ -37,7 +35,6 @@ macro_rules! ensure_eq {
}
};
}
-
// Test Data
pub struct FooData {
pub age: i32,
@@ -45,8 +42,6 @@ pub struct FooData {
}
impl RWData<FooData> for FooData {
- type DataType = FooData;
-
async fn read(path: &PathBuf) -> Result<FooData, DataReadError> {
let content = tokio::fs::read_to_string(path)
.await
diff --git a/systems/_asset/test/src/lib.rs b/systems/_asset/test/src/lib.rs
index 4aad777..4b62028 100644
--- a/systems/_asset/test/src/lib.rs
+++ b/systems/_asset/test/src/lib.rs
@@ -13,8 +13,6 @@ pub struct FooData {
}
impl RWData<FooData> for FooData {
- type DataType = FooData;
-
async fn read(path: &PathBuf) -> Result<FooData, DataReadError> {
let content = tokio::fs::read_to_string(path)
.await
diff --git a/systems/_framework/src/lib.rs b/systems/_framework/src/lib.rs
index b0a3f9b..80507d1 100644
--- a/systems/_framework/src/lib.rs
+++ b/systems/_framework/src/lib.rs
@@ -1,3 +1,6 @@
pub mod space;
-#[allow(unused_imports)]
-pub use space_macro::*;
+
+pub mod space_macro {
+ #[allow(unused_imports)]
+ pub use space_macro::*;
+}
diff --git a/systems/sheet/src/sheet.rs b/systems/sheet/src/sheet.rs
index 5ee2db7..cca2450 100644
--- a/systems/sheet/src/sheet.rs
+++ b/systems/sheet/src/sheet.rs
@@ -552,9 +552,7 @@ impl TryFrom<&[u8]> for SheetData {
}
impl RWData<SheetData> for SheetData {
- type DataType = SheetData;
-
- async fn read(path: &PathBuf) -> Result<Self::DataType, asset_system::error::DataReadError> {
+ async fn read(path: &PathBuf) -> Result<SheetData, asset_system::error::DataReadError> {
let read_data = SheetData::full_read(&mut SheetData::empty(), path).await;
match read_data {
Ok(_) => {
@@ -573,7 +571,7 @@ impl RWData<SheetData> for SheetData {
}
async fn write(
- data: Self::DataType,
+ data: SheetData,
path: &PathBuf,
) -> Result<(), asset_system::error::DataWriteError> {
let write_data = tokio::fs::write(path, data.as_bytes()).await;
@@ -585,7 +583,7 @@ impl RWData<SheetData> for SheetData {
}
}
- fn test_data() -> Self::DataType {
+ fn test_data() -> SheetData {
let sheet = SheetData::empty().pack("sheet");
let mut sheet = sheet;
sheet
@@ -601,7 +599,7 @@ impl RWData<SheetData> for SheetData {
sheet.unpack()
}
- fn verify_data(data_a: Self::DataType, data_b: Self::DataType) -> bool {
+ fn verify_data(data_a: SheetData, data_b: SheetData) -> bool {
data_a == data_b
}
}
diff --git a/systems/vault/src/vault.rs b/systems/vault/src/vault.rs
index 262f8c5..fa3f9b5 100644
--- a/systems/vault/src/vault.rs
+++ b/systems/vault/src/vault.rs
@@ -3,7 +3,7 @@ use constants::vault::{
dirs::{vault_dir_changes, vault_dir_ignore_rules, vault_dir_member_root, vault_dir_refsheets},
files::vault_file_config,
};
-use framework::{SpaceRootTest, space::SpaceRoot};
+use framework::{space::SpaceRoot, space_macro::SpaceRootTest};
use tokio::fs;
use crate::vault::config::VaultConfig;
diff --git a/systems/vault/src/vault/config.rs b/systems/vault/src/vault/config.rs
index 7c4db70..329f78e 100644
--- a/systems/vault/src/vault/config.rs
+++ b/systems/vault/src/vault/config.rs
@@ -6,11 +6,9 @@ use serde::{Deserialize, Serialize};
pub struct VaultConfig {}
impl RWData<VaultConfig> for VaultConfig {
- type DataType = VaultConfig;
-
async fn read(
path: &std::path::PathBuf,
- ) -> Result<Self::DataType, asset_system::error::DataReadError> {
+ ) -> Result<VaultConfig, asset_system::error::DataReadError> {
let read_config = read_config(path).await;
match read_config {
Ok(config) => Ok(config),
@@ -21,7 +19,7 @@ impl RWData<VaultConfig> for VaultConfig {
}
async fn write(
- data: Self::DataType,
+ data: VaultConfig,
path: &std::path::PathBuf,
) -> Result<(), asset_system::error::DataWriteError> {
let write_config = write_config(path, &data).await;
@@ -35,11 +33,11 @@ impl RWData<VaultConfig> for VaultConfig {
}
}
- fn test_data() -> Self::DataType {
+ fn test_data() -> VaultConfig {
VaultConfig::default()
}
- fn verify_data(data_a: Self::DataType, data_b: Self::DataType) -> bool {
+ fn verify_data(data_a: VaultConfig, data_b: VaultConfig) -> bool {
&data_a == &data_b
}
}
diff --git a/systems/workspace/src/workspace.rs b/systems/workspace/src/workspace.rs
index 6310146..a34a000 100644
--- a/systems/workspace/src/workspace.rs
+++ b/systems/workspace/src/workspace.rs
@@ -1,6 +1,6 @@
use asset_system::rw::RWData;
use constants::workspace::{dirs::workspace_dir_workspace, files::workspace_file_config};
-use framework::{SpaceRootTest, space::SpaceRoot};
+use framework::{space::SpaceRoot, space_macro::SpaceRootTest};
use tokio::fs::create_dir_all;
use crate::workspace::config::WorkspaceConfig;
diff --git a/systems/workspace/src/workspace/config.rs b/systems/workspace/src/workspace/config.rs
index 278ec08..f43dc0e 100644
--- a/systems/workspace/src/workspace/config.rs
+++ b/systems/workspace/src/workspace/config.rs
@@ -85,9 +85,7 @@ impl WorkspaceConfig {
}
impl RWData<WorkspaceConfig> for WorkspaceConfig {
- type DataType = WorkspaceConfig;
-
- async fn read(path: &PathBuf) -> Result<Self::DataType, DataReadError> {
+ async fn read(path: &PathBuf) -> Result<WorkspaceConfig, DataReadError> {
let read_config = read_config(path).await;
match read_config {
Ok(config) => Ok(config),
@@ -98,7 +96,7 @@ impl RWData<WorkspaceConfig> for WorkspaceConfig {
}
}
- async fn write(data: Self::DataType, path: &PathBuf) -> Result<(), DataWriteError> {
+ async fn write(data: WorkspaceConfig, path: &PathBuf) -> Result<(), DataWriteError> {
let write_config = write_config(path, &data).await;
match write_config {
Ok(_) => Ok(()),
@@ -111,11 +109,11 @@ impl RWData<WorkspaceConfig> for WorkspaceConfig {
}
}
- fn test_data() -> Self::DataType {
+ fn test_data() -> WorkspaceConfig {
WorkspaceConfig::default()
}
- fn verify_data(data_a: Self::DataType, data_b: Self::DataType) -> bool {
+ fn verify_data(data_a: WorkspaceConfig, data_b: WorkspaceConfig) -> bool {
&data_a == &data_b
}
}