pub struct RootIntent {
pub id: IntentId,
pub kind: IntentKind,
pub objective: Option<Objective>,
pub scope: Scope,
pub constraints: Vec<IntentConstraint>,
pub success_criteria: SuccessCriteria,
pub budgets: Budgets,
}Expand description
The Root Intent — constitution of a Converge job.
This is the only entry point into a Converge runtime. It defines the universe of discourse, what is allowed, and what success means.
Fields§
§id: IntentIdUnique identifier.
kind: IntentKindThe class of problem.
objective: Option<Objective>What the system should optimize.
scope: ScopeWhat is in-bounds.
constraints: Vec<IntentConstraint>Hard and soft constraints.
success_criteria: SuccessCriteriaSuccess criteria.
budgets: BudgetsExecution budgets.
Implementations§
Source§impl RootIntent
impl RootIntent
Sourcepub fn new(kind: IntentKind) -> Self
pub fn new(kind: IntentKind) -> Self
Creates a new Root Intent with the given kind.
Sourcepub fn with_objective(self, objective: Objective) -> Self
pub fn with_objective(self, objective: Objective) -> Self
Sets the objective.
Sourcepub fn with_scope(self, scope: Scope) -> Self
pub fn with_scope(self, scope: Scope) -> Self
Sets the scope.
Sourcepub fn with_constraint(self, constraint: IntentConstraint) -> Self
pub fn with_constraint(self, constraint: IntentConstraint) -> Self
Adds a constraint.
Sourcepub fn with_success_criterion(self, criterion: SuccessCriterion) -> Self
pub fn with_success_criterion(self, criterion: SuccessCriterion) -> Self
Adds a success criterion (required).
Sourcepub fn with_success_criteria(self, criteria: SuccessCriteria) -> Self
pub fn with_success_criteria(self, criteria: SuccessCriteria) -> Self
Sets the success criteria.
Sourcepub fn with_budgets(self, budgets: Budgets) -> Self
pub fn with_budgets(self, budgets: Budgets) -> Self
Sets the budgets.
Sourcepub fn validate(&self) -> Result<(), IntentValidationError>
pub fn validate(&self) -> Result<(), IntentValidationError>
Validates the Root Intent.
§Errors
Returns error if:
- Scope is not defined
- Success criteria are not explicit
Sourcepub fn to_seed_facts(&self) -> Vec<Fact>
pub fn to_seed_facts(&self) -> Vec<Fact>
Creates initial seed facts from this intent.
These facts are added to the context at the start of execution.
Sourcepub fn hard_constraints(&self) -> Vec<&IntentConstraint>
pub fn hard_constraints(&self) -> Vec<&IntentConstraint>
Returns hard constraints.
Sourcepub fn soft_constraints(&self) -> Vec<&IntentConstraint>
pub fn soft_constraints(&self) -> Vec<&IntentConstraint>
Returns soft constraints.
Sourcepub fn is_successful(&self, ctx: &Context) -> bool
pub fn is_successful(&self, ctx: &Context) -> bool
Checks if success criteria are satisfied by the context.
Trait Implementations§
Source§impl Clone for RootIntent
impl Clone for RootIntent
Source§fn clone(&self) -> RootIntent
fn clone(&self) -> RootIntent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for RootIntent
impl RefUnwindSafe for RootIntent
impl Send for RootIntent
impl Sync for RootIntent
impl Unpin for RootIntent
impl UnwindSafe for RootIntent
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
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>
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>
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