#[non_exhaustive]pub struct Violation {
pub step: Option<StepRef>,
pub kind: ViolationKind,
}Expand description
Why a plan is invalid.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.step: Option<StepRef>The step that fails, or None if the plan text or the goal does.
kind: ViolationKindWhat fails.
Implementations§
Source§impl Violation
impl Violation
Sourcepub fn advice(&self) -> String
pub fn advice(&self) -> String
Returns a repair hint in the style of VAL’s “Plan Repair Advice”.
§Examples
use pddl::{Domain, Parser, Problem};
use pddl_validate::Validator;
let domain = Domain::from_str("(define (domain d) (:predicates (p) (q))
(:action a :parameters () :precondition (p) :effect (q)))").unwrap();
let problem = Problem::from_str("(define (problem x) (:domain d) (:init) (:goal (q)))").unwrap();
let report = Validator::new(&domain, &problem).unwrap().validate_text("(a)");
let advice = report.violation().unwrap().advice();
assert_eq!(advice, "(a) has an unsatisfied precondition at step 1: (Set (p) to true)");Trait Implementations§
impl StructuralPartialEq for Violation
Auto Trait Implementations§
impl Forget for Violation
impl Freeze for Violation
impl Move for Violation
impl RefUnwindSafe for Violation
impl Send for Violation
impl Sync for Violation
impl Unpin for Violation
impl UnsafeUnpin for Violation
impl UnwindSafe for Violation
Blanket Implementations§
Source§impl<V, T, O> AcceptMut<V, T, O> for Twhere
V: VisitorMut<T, O>,
impl<V, T, O> AcceptMut<V, T, O> for Twhere
V: VisitorMut<T, O>,
Source§fn accept_mut(&self, v: &mut V) -> O
fn accept_mut(&self, v: &mut V) -> O
Lets the mutable visitor
v visit self.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