pub struct StoredPlan {
pub assessment: String,
pub plan: ReviewPlan,
pub availability: Vec<AdvisorState>,
}Expand description
A plan as stored: the decision and the availability it was made against.
The store builds it when it admits a PlanInput; nothing else does. The snapshot of
availability is what a later consultation is admitted against, so an answer that
arrives after the advisor’s circuit opened still belongs to the plan that asked for it.
use majordomus_cli::reasoning::availability::{ModeResolution, ReasoningMode};
use majordomus_cli::reasoning::policy::PlanOutcome;
use majordomus_cli::reasoning::record::*;
use majordomus_cli::reasoning::store::{admit, Admission, Loaded};
let mode = ModeResolution { mode: ReasoningMode::Standard, source: "default".into() };
let admission = Admission { mode: &mode, availability: &[] };
let mut loaded = Loaded::default();
loaded.records.push(ReasoningRecord {
schema: RECORD_SCHEMA.into(),
version: RECORD_VERSION,
id: "assessment-1".into(),
task: "t".into(),
recorded_at: "2026-10-01T00:00:01Z".into(),
head: None,
redacted: vec![],
body: ReasoningBody::Assessment(AssessmentInput {
subject: "a name".into(),
..Default::default()
}),
});
let input = ReasoningInput::Plan(PlanInput { assessment: "assessment-1".into() });
let ReasoningBody::Plan(stored) = admit(input, &loaded, &admission).unwrap() else {
panic!("a plan input is stored as a plan");
};
let stored: StoredPlan = stored;
assert_eq!(stored.assessment, "assessment-1");
assert_eq!(stored.plan.outcome, PlanOutcome::DecideLocally);
assert!(stored.availability.is_empty());Fields§
§assessment: StringThe assessment it answers.
plan: ReviewPlanThe decision.
availability: Vec<AdvisorState>Every advisor’s standing at the moment of the plan: the snapshot a later consultation is admitted against.
Trait Implementations§
Source§impl Clone for StoredPlan
impl Clone for StoredPlan
Source§fn clone(&self) -> StoredPlan
fn clone(&self) -> StoredPlan
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StoredPlan
impl Debug for StoredPlan
Source§impl<'de> Deserialize<'de> for StoredPlan
impl<'de> Deserialize<'de> for StoredPlan
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl JsonSchema for StoredPlan
impl JsonSchema for StoredPlan
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for StoredPlan
impl RefUnwindSafe for StoredPlan
impl Send for StoredPlan
impl Sync for StoredPlan
impl Unpin for StoredPlan
impl UnsafeUnpin for StoredPlan
impl UnwindSafe for StoredPlan
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more