Skip to main content

DataActorNative

Trait DataActorNative 

Source
pub trait DataActorNative {
    // Required methods
    fn core(&self) -> &DataActorCore;
    fn core_mut(&mut self) -> &mut DataActorCore;

    // Provided methods
    fn dispatch_start(&mut self) -> Result<()>
       where Self: DataActor { ... }
    fn clock_mut(&mut self) -> RefMut<'_, dyn Clock> { ... }
    fn try_clock_mut(
        &mut self,
    ) -> Result<RefMut<'_, dyn Clock>, ComponentAccessError> { ... }
    fn clock_rc(&self) -> Rc<RefCell<dyn Clock>> { ... }
    fn cache_ref(&self) -> Ref<'_, Cache> { ... }
    fn try_cache_ref(&self) -> Result<Ref<'_, Cache>, ComponentAccessError> { ... }
    fn cache_rc(&self) -> Rc<RefCell<Cache>> { ... }
}
Expand description

Explicit native-only access for data actor runtime state.

Normal actor and strategy code should use facade methods such as DataActor::clock and DataActor::cache. Import this trait only from Rust code compiled into the same native binary as the engine, when a performance-sensitive path or host integration needs access below the facade API.

Do not import this trait in strategy code intended to run through Python or the plug-in authoring surface. Native borrows, Rc<RefCell<_>>, and core references do not cross those boundaries.

Required Methods§

Source

fn core(&self) -> &DataActorCore

Returns the actor core.

Source

fn core_mut(&mut self) -> &mut DataActorCore

Returns the mutable actor core.

Provided Methods§

Source

fn dispatch_start(&mut self) -> Result<()>
where Self: DataActor,

Dispatches framework startup and the user-facing start callback.

Overrides call DataActor::on_start once after successful framework startup. The default implementation only calls DataActor::on_start.

§Errors

Returns an error if framework startup or the user callback fails.

Source

fn clock_mut(&mut self) -> RefMut<'_, dyn Clock>

Returns the mutable clock borrow for the actor.

§Panics

Panics if the actor is unregistered or the clock is already borrowed.

Source

fn try_clock_mut( &mut self, ) -> Result<RefMut<'_, dyn Clock>, ComponentAccessError>

Returns a mutable clock borrow without panicking on an access conflict.

§Errors

Returns an error if the actor is unregistered or the clock is already borrowed.

Source

fn clock_rc(&self) -> Rc<RefCell<dyn Clock>>

Returns a clone of the reference-counted clock.

§Panics

Panics if the actor has not yet been registered.

Source

fn cache_ref(&self) -> Ref<'_, Cache>

Returns a read-only cache borrow.

§Panics

Panics if the actor is unregistered or the cache is already mutably borrowed.

Source

fn try_cache_ref(&self) -> Result<Ref<'_, Cache>, ComponentAccessError>

Returns a cache borrow without panicking on an access conflict.

§Errors

Returns an error if the actor is unregistered or the cache is already mutably borrowed.

Source

fn cache_rc(&self) -> Rc<RefCell<Cache>>

Returns a clone of the reference-counted cache.

§Panics

Panics if the actor has not yet been registered.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§