peace_data/marker/
goal.rs

1use serde::{Deserialize, Serialize};
2
3/// Marker for goal state.
4///
5/// This is used for referential param values, where an item param value is
6/// dependent on the state of a predecessor's state.
7///
8/// A `Goal<Item::State>` is set to `Some` whenever an item's goal state
9/// is discovered. enabling a subsequent successor's params to access that value
10/// when the successor's goal state function is run.
11///
12/// Note: A successor's goal state is dependent on the predecessor's goal
13/// state, which should be in sync with its current state after
14/// `ApplyFns::exec` has been executed.
15#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
16pub struct Goal<T>(pub Option<T>);
17
18impl<T> std::ops::Deref for Goal<T> {
19    type Target = Option<T>;
20
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25
26impl<T> std::ops::DerefMut for Goal<T> {
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}