pub trait DataActorNative {
// Required methods
fn core(&self) -> &DataActorCore;
fn core_mut(&mut self) -> &mut DataActorCore;
// Provided methods
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§
Sourcefn core(&self) -> &DataActorCore
fn core(&self) -> &DataActorCore
Returns the actor core.
Sourcefn core_mut(&mut self) -> &mut DataActorCore
fn core_mut(&mut self) -> &mut DataActorCore
Returns the mutable actor core.
Provided Methods§
Sourcefn clock_mut(&mut self) -> RefMut<'_, dyn Clock>
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.
Sourcefn try_clock_mut(
&mut self,
) -> Result<RefMut<'_, dyn Clock>, ComponentAccessError>
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.
Sourcefn clock_rc(&self) -> Rc<RefCell<dyn Clock>>
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.
Sourcefn cache_ref(&self) -> Ref<'_, Cache>
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.
Sourcefn try_cache_ref(&self) -> Result<Ref<'_, Cache>, ComponentAccessError>
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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".