pddl/types/
action_definition.rs1use crate::types::TypedVariables;
4use crate::types::{ActionSymbol, Effects};
5use crate::PreconditionGoalDefinitions;
6
7#[derive(Debug, Clone, PartialEq)]
12pub struct ActionDefinition {
13 symbol: ActionSymbol,
14 parameters: TypedVariables,
15 precondition: PreconditionGoalDefinitions,
16 effect: Option<Effects>,
17}
18
19impl ActionDefinition {
20 pub const fn new(
21 symbol: ActionSymbol,
22 parameters: TypedVariables,
23 precondition: PreconditionGoalDefinitions,
24 effect: Option<Effects>,
25 ) -> Self {
26 Self {
27 symbol,
28 parameters,
29 precondition,
30 effect,
31 }
32 }
33
34 pub const fn symbol(&self) -> &ActionSymbol {
35 &self.symbol
36 }
37
38 pub const fn parameters(&self) -> &TypedVariables {
39 &self.parameters
40 }
41
42 pub const fn precondition(&self) -> &PreconditionGoalDefinitions {
43 &self.precondition
44 }
45
46 pub const fn effect(&self) -> &Option<Effects> {
47 &self.effect
48 }
49}
50
51impl AsRef<ActionSymbol> for ActionDefinition {
52 fn as_ref(&self) -> &ActionSymbol {
53 &self.symbol
54 }
55}