pub trait Behavior:
Component<Mutability = Mutable>
+ Debug
+ Sized {
// Provided methods
fn filter_yield(&self, next: &Self) -> bool { ... }
fn filter_next(&self, next: &Self) -> bool { ... }
fn is_resumable(&self) -> bool { ... }
fn on_start(
&self,
_previous: Option<&Self>,
_commands: InstanceCommands<'_, Self>,
) { ... }
fn on_pause(&self, _current: &Self, _commands: InstanceCommands<'_, Self>) { ... }
fn on_resume(&self, _previous: &Self, _commands: InstanceCommands<'_, Self>) { ... }
fn on_stop(&self, _current: &Self, _commands: InstanceCommands<'_, Self>) { ... }
fn on_activate(
&self,
_previous: Option<&Self>,
_commands: InstanceCommands<'_, Self>,
) { ... }
fn on_suspend(&self, _current: &Self, _commands: InstanceCommands<'_, Self>) { ... }
}Expand description
Provided Methods§
Sourcefn filter_yield(&self, next: &Self) -> bool
fn filter_yield(&self, next: &Self) -> bool
Called when an interrupt is requested.
If this returns true, the current behavior will stop to allow the next behavior to start.
The initial behavior is never allowed to yield.
Sourcefn filter_next(&self, next: &Self) -> bool
fn filter_next(&self, next: &Self) -> bool
Called before a new behavior is started.
If this returns false, the transition fails.
See Error for details on how to handle transition failures.
Sourcefn is_resumable(&self) -> bool
fn is_resumable(&self) -> bool
Called after a behavior is paused.
If this returns false, the paused behavior will be stopped immediatedly and discarded.
No Pause event will be sent in this case.
Sourcefn on_start(
&self,
_previous: Option<&Self>,
_commands: InstanceCommands<'_, Self>,
)
fn on_start( &self, _previous: Option<&Self>, _commands: InstanceCommands<'_, Self>, )
Called during transition just after the behavior is started.
Sourcefn on_pause(&self, _current: &Self, _commands: InstanceCommands<'_, Self>)
fn on_pause(&self, _current: &Self, _commands: InstanceCommands<'_, Self>)
Called during transition just after the behavior is paused.
Sourcefn on_resume(&self, _previous: &Self, _commands: InstanceCommands<'_, Self>)
fn on_resume(&self, _previous: &Self, _commands: InstanceCommands<'_, Self>)
Called during transition just after the behavior is resumed.
Sourcefn on_stop(&self, _current: &Self, _commands: InstanceCommands<'_, Self>)
fn on_stop(&self, _current: &Self, _commands: InstanceCommands<'_, Self>)
Called during transition just after the behavior is stopped.
Sourcefn on_activate(
&self,
_previous: Option<&Self>,
_commands: InstanceCommands<'_, Self>,
)
fn on_activate( &self, _previous: Option<&Self>, _commands: InstanceCommands<'_, Self>, )
Called during transition just after the behavior is started or resumed.
Sourcefn on_suspend(&self, _current: &Self, _commands: InstanceCommands<'_, Self>)
fn on_suspend(&self, _current: &Self, _commands: InstanceCommands<'_, Self>)
Called during transition just after the behavior is paused or stopped.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.