Skip to main content

LightweightRtObject

Struct LightweightRtObject 

Source
pub struct LightweightRtObject { /* private fields */ }
Expand description

LightweightRTObject — Spec §5.2.2.2 (S. 12-19).

Verwaltet:

  • Lifecycle-State pro Execution-Context (Spec §5.2.2.3).
  • Liste aller Contexts in denen das RTC participates.
  • Owner-Context-Handle (das RTC kann selbst Owner eines Contexts sein — autonomous RTC, Spec §5.2.2.5).
  • Reference auf den ComponentAction-Callbacks (Box<dyn> damit Caller eigene Behavior einbauen kann).

State-Machine wird zentral hier durchgesetzt — alle Operations pruefen Pre-Conditions und liefern PRECONDITION_NOT_MET im Fehlerfall (Spec §5.2.2.2.x).

Implementations§

Source§

impl LightweightRtObject

Source

pub fn new(callbacks: Box<dyn ComponentAction>) -> Self

Konstruiert ein neues, noch nicht initialisiertes RTC im Created-Zustand. Spec §5.2.2.3.1.

Source

pub fn initialize(&mut self) -> ReturnCode

Spec §5.2.2.2.1 — initialize: Created → Alive (Inactive in jedem attached Context).

“An RTC may be initialized only while it is in the Created state. Any attempt to invoke this operation while in another state shall fail with PRECONDITION_NOT_MET.”

Source

pub fn finalize(&mut self) -> ReturnCode

Spec §5.2.2.2.2 — finalize: Alive → Created (no longer attached to any context).

“An RTC may not be finalized while it is participating in any execution context.”

Source

pub const fn is_alive(&self) -> bool

Spec §5.2.2.2.3 — is_alive. “is alive or not regardless of the execution context from which it is observed”.

Source

pub fn attach_context(&mut self) -> Result<ExecutionContextHandle, ReturnCode>

Spec §5.2.2.2.5 — attach_context: registriert das RTC fuer einen Context. Liefert ein neues Handle.

“This operation is intended to be invoked by ExecutionContextOperations::add_component. It is not intended for use by other clients.”

Source

pub fn detach_context(&mut self, handle: ExecutionContextHandle) -> ReturnCode

Spec §5.2.2.2.6 — detach_context. “may not be invoked if this RTC is Active in the indicated execution context”.

Source

pub fn get_participating_contexts(&self) -> Vec<ExecutionContextHandle>

Spec §5.2.2.2.9 — get_participating_contexts. Liefert eine Liste der Handles in denen dieses RTC participates.

Source

pub fn get_context_state( &self, handle: ExecutionContextHandle, ) -> Option<LifeCycleState>

Spec §5.2.2.6.x via Caller invoked — Ueberprueft ob das RTC im gegebenen Context im erwarteten State ist.

Source

pub fn transition_to_error(&mut self, handle: ExecutionContextHandle)

Forciert Active → Error nach Callback-Fehler in User-Code. Spec §5.2.2.4.7 — on_aborting wird einmalig invoked, danach uebernimmt on_error (siehe Periodic-Tick-Loop).

Source

pub fn callbacks_mut(&mut self) -> &mut dyn ComponentAction

Liefert mutable-Zugriff auf die Callbacks. Wird vom ExecutionContext::tick-Loop benoetigt, um die periodischen on_execute/on_state_update/on_error-Callbacks zu invoken.

Trait Implementations§

Source§

impl Debug for LightweightRtObject

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.