pub enum CompositionConfig {
Sequence {
children: Vec<CompositionConfig>,
name: Option<String>,
},
Selector {
children: Vec<CompositionConfig>,
name: Option<String>,
},
Parallel {
children: Vec<CompositionConfig>,
policy: ParallelPolicyConfig,
name: Option<String>,
},
Watch {
children: Vec<CompositionConfig>,
policy: ParallelPolicyConfig,
name: Option<String>,
},
Subsumption {
layers: Vec<SubsumptionLayerConfig>,
name: Option<String>,
},
Inverter {
child: Box<CompositionConfig>,
name: Option<String>,
},
ForceSuccess {
child: Box<CompositionConfig>,
name: Option<String>,
},
ForceFailure {
child: Box<CompositionConfig>,
name: Option<String>,
},
Repeat {
child: Box<CompositionConfig>,
count: Option<u32>,
name: Option<String>,
},
Retry {
child: Box<CompositionConfig>,
max_attempts: u32,
name: Option<String>,
},
Timeout {
child: Box<CompositionConfig>,
timeout_secs: f64,
name: Option<String>,
},
Node {
node: String,
config_ref: Option<String>,
config: Option<Value>,
name: Option<String>,
},
}Expand description
A node in a behavior tree: either a composite control-flow node or a leaf behavior node.
Variants§
Sequence
Runs its children in order, stopping early if one fails.
Fields
children: Vec<CompositionConfig>Child nodes to run in order.
Selector
Runs its children in order, stopping early if one succeeds.
Fields
children: Vec<CompositionConfig>Child nodes to try in order.
Parallel
Runs all of its children concurrently.
Fields
children: Vec<CompositionConfig>Child nodes to run concurrently.
policy: ParallelPolicyConfigPolicy determining when this node succeeds based on its children’s outcomes.
Watch
Like Parallel, but every child is re-ticked every call regardless of its previous
status - no “frozen once resolved” memory. Use this for a condition that must be
re-evaluated indefinitely, e.g. inside a Subsumption layer.
Fields
children: Vec<CompositionConfig>Child nodes, all re-ticked every call.
policy: ParallelPolicyConfigPolicy determining when this node succeeds/fails based on its children’s outcomes.
Subsumption
Priority-based preemption (subsumption architecture): tries each layer highest-priority
first; the first to return Running/Success wins for that tick. A layer returns
Failure to cede control to the next layer down, within the same tick.
Fields
layers: Vec<SubsumptionLayerConfig>Priority layers, highest priority first (ties broken by declaration order).
Inverter
Negates its child’s Success/Failure result; Running passes through unchanged.
Fields
child: Box<CompositionConfig>The single child node to invert.
ForceSuccess
Reports Success once its child resolves, regardless of the child’s actual result;
Running passes through unchanged. Useful for an optional/best-effort step whose
failure shouldn’t abort a surrounding Sequence.
Fields
child: Box<CompositionConfig>The single child node to force-succeed.
ForceFailure
Reports Failure once its child resolves, regardless of the child’s actual result;
Running passes through unchanged. The mirror of ForceSuccess.
Fields
child: Box<CompositionConfig>The single child node to force-fail.
Repeat
Re-runs its child every time it succeeds, up to an optional fixed count; a Failure
ends the loop immediately with Failure. Omit count to repeat indefinitely.
Fields
child: Box<CompositionConfig>The single child node to repeat.
Retry
Re-runs its child up to max_attempts times whenever it fails, succeeding as soon as one
attempt succeeds; only fails once every attempt is exhausted.
Fields
child: Box<CompositionConfig>The single child node to retry.
Timeout
Bounds how long its child may stay Running: fails immediately once timeout_secs have
elapsed since this node started ticking the child (without resolving).
Fields
child: Box<CompositionConfig>The single child node to bound.
Node
A leaf node that runs a single behavior node implementation.
Trait Implementations§
Source§impl Clone for CompositionConfig
impl Clone for CompositionConfig
Source§impl Debug for CompositionConfig
impl Debug for CompositionConfig
Source§impl<'de> Deserialize<'de> for CompositionConfig
impl<'de> Deserialize<'de> for CompositionConfig
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>,
Source§impl JsonSchema for CompositionConfig
impl JsonSchema for CompositionConfig
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for CompositionConfig
impl RefUnwindSafe for CompositionConfig
impl Send for CompositionConfig
impl Sync for CompositionConfig
impl Unpin for CompositionConfig
impl UnsafeUnpin for CompositionConfig
impl UnwindSafe for CompositionConfig
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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