Struct aspen::std_nodes::AlwaysFail [] [src]

pub struct AlwaysFail { /* fields omitted */ }

Implements a node that always returns that it has failed.

This node potentially takes a child node. If it does, then it will tick that node until it is completed, disregard the child's status, and return that it failed. If it does not have a child node, it will simply fail on every tick.

State

Initialized: Before being ticked after either being created or reset.

Running: While child is running. If no child, then never.

Succeeded: Never.

Failed: After child finishes. If no child, always.

Children

One optional child. The child will be reset every time this node is reset.

Examples

An AlwaysFail node always fails when it has no child:

let mut node = AlwaysFail::new();
assert_eq!(node.tick(), Status::Failed);

If the child is considered running, so is this node:

let mut node = AlwaysFail::with_child(AlwaysRunning::new());
assert_eq!(node.tick(), Status::Running);

If the child is done running, its status is disregarded:

let mut node = AlwaysFail::with_child(AlwaysSucceed::new());
assert_eq!(node.tick(), Status::Failed);

Methods

impl AlwaysFail
[src]

Construct a new AlwaysFail node.

Construct a new AlwaysFail node that has a child.

Trait Implementations

impl Internals for AlwaysFail
[src]

Ticks the internal state of the node a single time. Read more

Resets the internal state of the node. Read more

Returns a vector of references to this node's children. Read more

Returns the string "AlwaysFail".