1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
use PhantomData;
use crate;
/// Stored current `State`s for all `Item`s.
///
/// This is loaded into [`Resources`] at the beginning of any command execution,
/// from the [`StatesCurrentFile`].
///
/// This is distinct from [`StatesCurrent`] to address the following use cases:
///
/// * Discovering current state from what is recorded in the
/// [`StatesCurrentFile`].
/// * Discovering current state and comparing it with previous state within the
/// same execution.
///
/// # Implementors
///
/// If an `Item`'s state discovery depends on the `State` of a previous
/// `Item`, then you should insert the predecessor's state into
/// [`Resources`], and reference that in the subsequent `TryFnSpec`'s [`Data`]:
///
/// ```rust
/// # use std::path::PathBuf;
/// #
/// # use peace_data::{Data, R};
/// #
/// /// Predecessor `TryFnSpec::Data`.
/// #[derive(Data, Debug)]
/// pub struct AppUploadParams<'exec> {
/// /// Path to the application directory.
/// app_dir: W<'exec, PathBuf>,
/// }
///
/// /// Successor `TryFnSpec::Data`.
/// #[derive(Data, Debug)]
/// pub struct AppInstallParams<'exec> {
/// /// Path to the application directory.
/// app_dir: R<'exec, PathBuf>,
/// /// Configuration to use.
/// config: W<'exec, String>,
/// }
/// ```
///
/// You may reference [`StatesCurrentStored`] in `ApplyFns::Data` for reading.
/// It is not mutable as `StatesCurrentStored` must remain unchanged so that all
/// `Item`s operate over consistent data.
///
/// [`StatesCurrentFile`]: crate::paths::StatesCurrentFile
/// [`Data`]: peace_data::Data
/// [`Resources`]: crate::Resources
pub type StatesCurrentStored = ;