Struct ark_api::behavior_controller::BehaviorInstance
source · pub struct BehaviorInstance(_);Expand description
Weak reference to a behavior instance that lives somewhere in an external behavior module.
Cloning will create another reference to the same behavior instance. If you want to do a deep
clone that creates a new instance, use the BehaviorInstance::deep_clone function.
The instance is destroyed when all its weak references are dropped.
Implementations§
source§impl BehaviorInstance
impl BehaviorInstance
sourcepub fn new(type_id: BehaviorTypeId, params: &str) -> Self
pub fn new(type_id: BehaviorTypeId, params: &str) -> Self
Create a behavior instance of the specific type with the provided construction parameters
sourcepub fn restore(type_id: BehaviorTypeId, bytes: &[u8]) -> Self
pub fn restore(type_id: BehaviorTypeId, bytes: &[u8]) -> Self
Restore a behavior instance by deserializing it from a persistent representation
sourcepub fn deep_clone(instance: &Self) -> Self
pub fn deep_clone(instance: &Self) -> Self
Creates a clone of the current instance, and returns a reference to the newly created one.
sourcepub fn type_id(&self) -> BehaviorTypeId
pub fn type_id(&self) -> BehaviorTypeId
Retrieve the BehaviorTypeId of this instance
Trait Implementations§
source§impl Clone for BehaviorInstance
impl Clone for BehaviorInstance
source§fn clone(&self) -> BehaviorInstance
fn clone(&self) -> BehaviorInstance
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for BehaviorInstance
impl Debug for BehaviorInstance
source§impl Hash for BehaviorInstance
impl Hash for BehaviorInstance
source§impl PartialEq<BehaviorInstance> for BehaviorInstance
impl PartialEq<BehaviorInstance> for BehaviorInstance
source§fn eq(&self, other: &BehaviorInstance) -> bool
fn eq(&self, other: &BehaviorInstance) -> bool
This method tests for
self and other values to be equal, and is used
by ==.