Skip to main content

Component

Trait Component 

Source
pub trait Component {
Show 26 methods // Required methods fn component_id(&self) -> ComponentId; fn state(&self) -> ComponentState; fn transition_state(&mut self, trigger: ComponentTrigger) -> Result<()>; fn register( &mut self, trader_id: TraderId, clock: Rc<RefCell<dyn Clock>>, cache: Rc<RefCell<Cache>>, ) -> Result<()>; // Provided methods fn is_ready(&self) -> bool { ... } fn not_running(&self) -> bool { ... } fn is_running(&self) -> bool { ... } fn is_stopped(&self) -> bool { ... } fn is_degraded(&self) -> bool { ... } fn is_faulted(&self) -> bool { ... } fn is_disposed(&self) -> bool { ... } fn initialize(&mut self) -> Result<()> { ... } fn start(&mut self) -> Result<()> { ... } fn stop(&mut self) -> Result<()> { ... } fn resume(&mut self) -> Result<()> { ... } fn degrade(&mut self) -> Result<()> { ... } fn fault(&mut self) -> Result<()> { ... } fn reset(&mut self) -> Result<()> { ... } fn dispose(&mut self) -> Result<()> { ... } fn on_start(&mut self) -> Result<()> { ... } fn on_stop(&mut self) -> Result<()> { ... } fn on_resume(&mut self) -> Result<()> { ... } fn on_reset(&mut self) -> Result<()> { ... } fn on_dispose(&mut self) -> Result<()> { ... } fn on_degrade(&mut self) -> Result<()> { ... } fn on_fault(&mut self) -> Result<()> { ... }
}
Expand description

Components have state and lifecycle management capabilities.

Required Methods§

Source

fn component_id(&self) -> ComponentId

Returns the unique identifier for this component.

Source

fn state(&self) -> ComponentState

Returns the current state of the component.

Source

fn transition_state(&mut self, trigger: ComponentTrigger) -> Result<()>

Transition the component with the state trigger.

§Errors

Returns an error if the trigger is an invalid transition from the current state.

Source

fn register( &mut self, trader_id: TraderId, clock: Rc<RefCell<dyn Clock>>, cache: Rc<RefCell<Cache>>, ) -> Result<()>

Registers the component with a system.

§Errors

Returns an error if the component fails to register.

Provided Methods§

Source

fn is_ready(&self) -> bool

Returns whether the component is ready.

Source

fn not_running(&self) -> bool

Returns whether the component is not running.

Source

fn is_running(&self) -> bool

Returns whether the component is running.

Source

fn is_stopped(&self) -> bool

Returns whether the component is stopped.

Source

fn is_degraded(&self) -> bool

Returns whether the component has been degraded.

Source

fn is_faulted(&self) -> bool

Returns whether the component has been faulted.

Source

fn is_disposed(&self) -> bool

Returns whether the component has been disposed.

Source

fn initialize(&mut self) -> Result<()>

Initializes the component.

§Errors

Returns an error if the initialization state transition fails.

Source

fn start(&mut self) -> Result<()>

Starts the component.

§Errors

Returns an error if the component fails to start.

Source

fn stop(&mut self) -> Result<()>

Stops the component.

§Errors

Returns an error if the component fails to stop.

Source

fn resume(&mut self) -> Result<()>

Resumes the component.

§Errors

Returns an error if the component fails to resume.

Source

fn degrade(&mut self) -> Result<()>

Degrades the component.

§Errors

Returns an error if the component fails to degrade.

Source

fn fault(&mut self) -> Result<()>

Faults the component.

§Errors

Returns an error if the component fails to fault.

Source

fn reset(&mut self) -> Result<()>

Resets the component to its initial state.

§Errors

Returns an error if the component fails to reset.

Source

fn dispose(&mut self) -> Result<()>

Disposes of the component, releasing any resources.

§Errors

Returns an error if the component fails to dispose.

Source

fn on_start(&mut self) -> Result<()>

Actions to be performed on start.

§Errors

Returns an error if starting the actor fails.

Source

fn on_stop(&mut self) -> Result<()>

Actions to be performed on stop.

§Errors

Returns an error if stopping the actor fails.

Source

fn on_resume(&mut self) -> Result<()>

Actions to be performed on resume.

§Errors

Returns an error if resuming the actor fails.

Source

fn on_reset(&mut self) -> Result<()>

Actions to be performed on reset.

§Errors

Returns an error if resetting the actor fails.

Source

fn on_dispose(&mut self) -> Result<()>

Actions to be performed on dispose.

§Errors

Returns an error if disposing the actor fails.

Source

fn on_degrade(&mut self) -> Result<()>

Actions to be performed on degrade.

§Errors

Returns an error if degrading the actor fails.

Source

fn on_fault(&mut self) -> Result<()>

Actions to be performed on fault.

§Errors

Returns an error if faulting the actor fails.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T> Component for T
where T: DataActor + DataActorNative + Debug + 'static,