pub struct OracleSession {
pub phase: OraclePhase,
pub question: String,
pub project_root: Option<PathBuf>,
pub context: Option<DecisionContext>,
pub criteria: Vec<Criterion>,
pub options: Vec<DecisionOption>,
pub ruling: Option<Ruling>,
pub record: Option<DecisionRecord>,
}Expand description
An oracle session that tracks the decision-making lifecycle.
Fields§
§phase: OraclePhaseCurrent phase.
question: StringThe question being decided.
project_root: Option<PathBuf>Optional project root.
context: Option<DecisionContext>Loaded context.
criteria: Vec<Criterion>Evaluation criteria.
options: Vec<DecisionOption>Options being considered.
ruling: Option<Ruling>The ruling (set in Rule phase).
record: Option<DecisionRecord>The final ADR (set in Document phase).
Implementations§
Source§impl OracleSession
impl OracleSession
Sourcepub fn with_project_root(self, root: impl Into<PathBuf>) -> Self
pub fn with_project_root(self, root: impl Into<PathBuf>) -> Self
Set the project root.
Sourcepub fn set_phase(&mut self, phase: OraclePhase)
pub fn set_phase(&mut self, phase: OraclePhase)
Set phase directly.
Sourcepub fn set_context(&mut self, ctx: DecisionContext)
pub fn set_context(&mut self, ctx: DecisionContext)
Set the decision context.
Sourcepub fn add_criterion(
&mut self,
name: impl Into<String>,
description: impl Into<String>,
weight: u8,
)
pub fn add_criterion( &mut self, name: impl Into<String>, description: impl Into<String>, weight: u8, )
Add a criterion.
Sourcepub fn add_option(&mut self, option: DecisionOption)
pub fn add_option(&mut self, option: DecisionOption)
Add an option.
Sourcepub fn option_count(&self) -> usize
pub fn option_count(&self) -> usize
Number of options.
Sourcepub fn score_options(&mut self)
pub fn score_options(&mut self)
Score all options against the criteria.
Sourcepub fn set_ruling(&mut self, ruling: Ruling)
pub fn set_ruling(&mut self, ruling: Ruling)
Set the ruling.
Sourcepub fn finalize(&mut self, status: DecisionStatus) -> Result<()>
pub fn finalize(&mut self, status: DecisionStatus) -> Result<()>
Finalize the decision record.
Trait Implementations§
Source§impl Clone for OracleSession
impl Clone for OracleSession
Source§fn clone(&self) -> OracleSession
fn clone(&self) -> OracleSession
Returns a duplicate of the value. Read more
1.0.0 · 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 OracleSession
impl Debug for OracleSession
Source§impl<'de> Deserialize<'de> for OracleSession
impl<'de> Deserialize<'de> for OracleSession
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
Auto Trait Implementations§
impl Freeze for OracleSession
impl RefUnwindSafe for OracleSession
impl Send for OracleSession
impl Sync for OracleSession
impl Unpin for OracleSession
impl UnsafeUnpin for OracleSession
impl UnwindSafe for OracleSession
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more