Skip to content

Commit

Permalink
Merge pull request #202 from azriel91/maintenance/187/move-crates-to-…
Browse files Browse the repository at this point in the history
…model-structure

Restructure crates into `_model` structure.
  • Loading branch information
azriel91 authored Feb 5, 2025
2 parents 17278be + f4aca08 commit a28b0cf
Show file tree
Hide file tree
Showing 293 changed files with 1,143 additions and 953 deletions.
6 changes: 0 additions & 6 deletions .cargo/audit.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
[advisories]
ignore = [
# `proc-macro-error` is Unmaintained.
#
# Transitive dependency of `syn_derive`.
# Pending <https://github.com/rs-tml/rstml/issues/56>.
"RUSTSEC-2024-0370",

# `derivative` is unmaintained.
#
# Transitive dependency of `log4rs`.
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## unreleased

* Split `flow_rt` and `state_rt` crates from `rt_model`. ([#187], [#202])
* Split `peace_core::progress` into `peace_progress_model` crate. ([#187], [#202])
* Make `ValueResolutionCtx` and `FieldNameAndType` serializable. ([#187], [#202])
* Rename `peace_item_model` to `peace_item_interaction_model`. ([#187], [#202])
* Move `ItemId` into `peace_item_model`. ([#187], [#202])
* Move `FlowId` into `peace_flow_model`. ([#187], [#202])
* Move `Profile` into `peace_profile_model`. ([#187], [#202])


[#202]: https://github.com/azriel91/peace/pull/202


## 0.0.14 (2025-01-18)

* Move `Cli*` types to `peace_cli` crate under `cli::output` module. ([#182], [#189])
Expand Down
32 changes: 24 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,17 @@ peace_cmd_rt = { workspace = true }
peace_data = { workspace = true }
peace_diff = { workspace = true }
peace_flow_model = { workspace = true }
peace_flow_rt = { workspace = true }
peace_fmt = { workspace = true }
peace_item_interaction_model = { workspace = true, optional = true }
peace_item_model = { workspace = true }
peace_params = { workspace = true }
peace_item_model = { workspace = true, optional = true }
peace_profile_model = { workspace = true }
peace_progress_model = { workspace = true, optional = true }
peace_resource_rt = { workspace = true }
peace_rt = { workspace = true }
peace_rt_model = { workspace = true }
peace_state_rt = { workspace = true }
peace_webi = { workspace = true, optional = true }
peace_webi_components = { workspace = true, optional = true }
peace_webi_model = { workspace = true, optional = true }
Expand Down Expand Up @@ -69,25 +74,29 @@ error_reporting = [
]
output_in_memory = ["peace_cli?/output_in_memory"]
output_progress = [
"dep:peace_progress_model",
"peace_cli?/output_progress",
"peace_cmd_rt/output_progress",
"peace_cfg/output_progress",
"peace_item_model/output_progress",
"peace_flow_rt/output_progress",
"peace_item_interaction_model/output_progress",
"peace_rt/output_progress",
"peace_rt_model/output_progress",
"peace_webi?/output_progress",
"peace_cmd_model/output_progress",
]
item_interactions = [
"dep:peace_item_model",
"dep:peace_item_interaction_model",
"peace_cfg/item_interactions",
"peace_flow_rt/item_interactions",
"peace_webi?/item_interactions",
"peace_webi_components?/item_interactions",
]
item_state_example = [
"peace_cfg/item_state_example",
"peace_cmd/item_state_example",
"peace_data/item_state_example",
"peace_flow_rt/item_state_example",
"peace_params/item_state_example",
"peace_rt_model/item_state_example",
"peace_webi?/item_state_example",
Expand Down Expand Up @@ -133,17 +142,22 @@ peace_data = { path = "crate/data", version = "0.0.14" }
peace_data_derive = { path = "crate/data_derive", version = "0.0.14" }
peace_diff = { path = "crate/diff", version = "0.0.14" }
peace_flow_model = { path = "crate/flow_model", version = "0.0.14" }
peace_flow_rt = { path = "crate/flow_rt", version = "0.0.14" }
peace_fmt = { path = "crate/fmt", version = "0.0.14" }
peace_item_interaction_model = { path = "crate/item_interaction_model", version = "0.0.14" }
peace_item_model = { path = "crate/item_model", version = "0.0.14" }
peace_params = { path = "crate/params", version = "0.0.14" }
peace_params_derive = { path = "crate/params_derive", version = "0.0.14" }
peace_item_model = { path = "crate/item_model", version = "0.0.14" }
peace_profile_model = { path = "crate/profile_model", version = "0.0.14" }
peace_progress_model = { path = "crate/progress_model", version = "0.0.14" }
peace_resource_rt = { path = "crate/resource_rt", version = "0.0.14" }
peace_rt = { path = "crate/rt", version = "0.0.14" }
peace_rt_model = { path = "crate/rt_model", version = "0.0.14" }
peace_rt_model_core = { path = "crate/rt_model_core", version = "0.0.14" }
peace_rt_model_hack = { path = "crate/rt_model_hack", version = "0.0.14" }
peace_rt_model_native = { path = "crate/rt_model_native", version = "0.0.14" }
peace_rt_model_web = { path = "crate/rt_model_web", version = "0.0.14" }
peace_state_rt = { path = "crate/state_rt", version = "0.0.14" }
peace_static_check_macros = { path = "crate/static_check_macros", version = "0.0.14" }
peace_value_traits = { path = "crate/value_traits", version = "0.0.14" }
peace_webi = { path = "crate/webi", version = "0.0.14" }
Expand Down Expand Up @@ -172,8 +186,8 @@ chrono = { version = "0.4.39", default-features = false, features = ["clock", "s
console = "0.15.10"
derivative = "2.2.0"
diff-struct = "0.5.3"
dot_ix = { version = "0.9.1", default-features = false }
dot_ix_model = "0.9.1"
dot_ix = { version = "0.9.2", default-features = false }
dot_ix_model = "0.9.2"
downcast-rs = "2.0.1"
dyn-clone = "1.0.17"
enser = "0.1.4"
Expand All @@ -182,7 +196,8 @@ fn_graph = { version = "0.15.0", features = ["async", "graph_info", "interruptib
futures = "0.3.31"
gloo-timers = "0.3.0"
heck = "0.5.0"
indexmap = "2.7.0"
id_newtype = "0.1.0"
indexmap = "2.7.1"
indicatif = "0.17.9"
interruptible = "0.2.4"
leptos = { version = "0.7" }
Expand All @@ -201,7 +216,7 @@ reqwest = "0.12.12"
resman = "0.18.0"
serde = "1.0.217"
serde-wasm-bindgen = "0.6.5"
serde_json = "1.0.135"
serde_json = "1.0.137"
serde_yaml = "0.9.34"
smallvec = "1.13.2"
syn = "2.0.96"
Expand All @@ -216,6 +231,7 @@ type_reg = { version = "0.8.0", features = ["debug", "untagged", "ordered"] }
url = "2.5.4"
wasm-bindgen = "0.2.100"
web-sys = "0.3.77"
yaml_error_context_hack = "0.1.0"

[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage_nightly)'] }
12 changes: 7 additions & 5 deletions crate/cfg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ dyn-clone = { workspace = true }
enser = { workspace = true }
peace_core = { workspace = true }
peace_data = { workspace = true }
peace_item_interaction_model = { workspace = true, optional = true }
peace_item_model = { workspace = true }
peace_params = { workspace = true }
peace_item_model = { workspace = true, optional = true }
peace_progress_model = { workspace = true, optional = true }
peace_resource_rt = { workspace = true }
serde = { workspace = true, features = ["derive"] }
tynm = { workspace = true }
Expand All @@ -35,9 +37,9 @@ tynm = { workspace = true }
default = []
error_reporting = ["peace_params/error_reporting"]
output_progress = [
"dep:peace_item_model",
"peace_core/output_progress",
"peace_item_model/output_progress",
"dep:peace_item_interaction_model",
"dep:peace_progress_model",
"peace_item_interaction_model/output_progress",
]
item_interactions = ["dep:peace_item_model"]
item_interactions = ["dep:peace_item_interaction_model"]
item_state_example = []
2 changes: 1 addition & 1 deletion crate/cfg/src/accessors/stored.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ use std::{
marker::PhantomData,
};

use peace_core::ItemId;
use peace_data::{
fn_graph::{
resman::{BorrowFail, Ref},
DataAccess, DataAccessDyn, Resources, TypeIds,
},
Data,
};
use peace_item_model::ItemId;
use peace_resource_rt::{states::StatesCurrentStored, type_reg::untagged::DataType};
use serde::Serialize;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use serde::{Deserialize, Serialize};

#[cfg(feature = "output_progress")]
use crate::progress::ProgressLimit;
use peace_progress_model::ProgressLimit;

/// Whether the `apply` function needs to be executed.
#[derive(Copy, Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
Expand Down
4 changes: 2 additions & 2 deletions crate/cfg/src/fn_ctx.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::marker::PhantomData;

use peace_core::ItemId;
use peace_item_model::ItemId;

#[cfg(feature = "output_progress")]
use peace_core::progress::ProgressSender;
use peace_progress_model::ProgressSender;

/// References to pass information between the Peace framework and an item.
#[derive(Clone, Copy, Debug)]
Expand Down
10 changes: 5 additions & 5 deletions crate/cfg/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ use std::fmt::{Debug, Display};

use async_trait::async_trait;
use dyn_clone::DynClone;
use peace_core::{ApplyCheck, ItemId};
use peace_data::Data;
use peace_item_model::ItemId;
use peace_params::{Params, ParamsSpec};
use peace_resource_rt::{resources::ts::Empty, Resources};
use serde::{de::DeserializeOwned, Serialize};

use crate::FnCtx;
use crate::{ApplyCheck, FnCtx};

/// Defines all of the data and logic to manage an item.
///
Expand Down Expand Up @@ -116,7 +116,7 @@ pub trait Item: DynClone {
+ Send
+ Sync
+ 'static
+ crate::RefInto<peace_item_model::ItemLocationState>;
+ crate::RefInto<peace_item_interaction_model::ItemLocationState>;

/// Diff between the current and target [`State`]s.
///
Expand Down Expand Up @@ -180,7 +180,7 @@ pub trait Item: DynClone {
/// a compile time check to ensure that these conditions are upheld.
///
/// ```rust
/// # use peace_cfg::{item_id, ItemId};
/// # use peace_item_model::{item_id, ItemId};
/// const fn id() -> ItemId {
/// item_id!("my_item")
/// }
Expand Down Expand Up @@ -510,5 +510,5 @@ pub trait Item: DynClone {
fn interactions(
params: &Self::Params<'_>,
data: Self::Data<'_>,
) -> Vec<peace_item_model::ItemInteraction>;
) -> Vec<peace_item_interaction_model::ItemInteraction>;
}
6 changes: 2 additions & 4 deletions crate/cfg/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,17 @@
// Re-exports
pub use async_trait::async_trait;
#[cfg(feature = "output_progress")]
pub use peace_core::progress;

pub use peace_core::*;

pub use crate::{fn_ctx::FnCtx, item::Item, state::State};
pub use crate::{apply_check::ApplyCheck, fn_ctx::FnCtx, item::Item, state::State};

#[cfg(feature = "output_progress")]
pub use crate::ref_into::RefInto;

pub mod accessors;
pub mod state;

mod apply_check;
mod fn_ctx;
mod item;

Expand Down
4 changes: 2 additions & 2 deletions crate/cfg/src/ref_into.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use peace_item_model::ItemLocationState;
use peace_item_interaction_model::ItemLocationState;

/// Returns `T` from a reference to `self`.
///
/// Allows setting a constraint on `Item::State`, such that `&State` can be
/// turned into an `peace_item_model::ItemLocationState`.
/// turned into an `peace_item_interaction_model::ItemLocationState`.
///
/// # Implementors
///
Expand Down
9 changes: 6 additions & 3 deletions crate/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ futures = { workspace = true }
peace_cli_model = { workspace = true }
peace_cmd_model = { workspace = true, optional = true }
peace_core = { workspace = true }
peace_item_model = { workspace = true, optional = true }
peace_fmt = { workspace = true }
peace_item_interaction_model = { workspace = true, optional = true }
peace_item_model = { workspace = true, optional = true }
peace_progress_model = { workspace = true, optional = true }
peace_rt_model_core = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
Expand All @@ -43,9 +45,10 @@ default = []
output_in_memory = ["peace_rt_model_core/output_in_memory"]
output_progress = [
"dep:peace_cmd_model",
"dep:peace_item_interaction_model",
"dep:peace_item_model",
"dep:peace_progress_model",
"peace_cmd_model/output_progress",
"peace_core/output_progress",
"peace_item_model/output_progress",
"peace_item_interaction_model/output_progress",
"peace_rt_model_core/output_progress",
]
22 changes: 10 additions & 12 deletions crate/cli/src/output/cli_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,17 @@ use crate::output::{CliColorize, CliMdPresenter, CliOutputBuilder};

cfg_if::cfg_if! {
if #[cfg(feature = "output_progress")] {
use peace_core::{
progress::{
CmdBlockItemInteractionType,
ProgressComplete,
ProgressLimit,
ProgressStatus,
ProgressTracker,
ProgressUpdate,
ProgressUpdateAndId,
},
ItemId,
use peace_item_model::ItemId;
use peace_item_interaction_model::ItemLocationState;
use peace_progress_model::{
CmdBlockItemInteractionType,
ProgressComplete,
ProgressLimit,
ProgressStatus,
ProgressTracker,
ProgressUpdate,
ProgressUpdateAndId,
};
use peace_item_model::ItemLocationState;
use peace_rt_model_core::{
indicatif::{ProgressDrawTarget, ProgressStyle},
CmdProgressTracker,
Expand Down
9 changes: 8 additions & 1 deletion crate/cmd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ own = { workspace = true }
peace_cfg = { workspace = true }
peace_code_gen = { workspace = true }
peace_core = { workspace = true }
peace_flow_rt = { workspace = true }
peace_item_model = { workspace = true }
peace_params = { workspace = true }
peace_profile_model = { workspace = true }
peace_progress_model = { workspace = true, optional = true }
peace_resource_rt = { workspace = true }
peace_rt_model = { workspace = true }
peace_state_rt = { workspace = true }
peace_value_traits = { workspace = true }
serde = { workspace = true }

Expand All @@ -41,11 +46,13 @@ tokio = { workspace = true, features = ["fs"] }
default = []
item_state_example = [
"peace_cfg/item_state_example",
"peace_flow_rt/item_state_example",
"peace_rt_model/item_state_example",
"peace_params/item_state_example",
]
output_progress = [
"dep:indicatif",
"peace_core/output_progress",
"dep:peace_progress_model",
"peace_flow_rt/output_progress",
"peace_rt_model/output_progress",
]
Loading

0 comments on commit a28b0cf

Please sign in to comment.