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
sourceimpl 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
sourceimpl Clone for BehaviorInstance
impl Clone for BehaviorInstance
sourcefn clone(&self) -> BehaviorInstance
fn clone(&self) -> BehaviorInstance
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for BehaviorInstance
impl Debug for BehaviorInstance
sourceimpl Hash for BehaviorInstance
impl Hash for BehaviorInstance
sourceimpl PartialEq<BehaviorInstance> for BehaviorInstance
impl PartialEq<BehaviorInstance> for BehaviorInstance
sourcefn 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 ==
. Read more
impl Eq for BehaviorInstance
impl StructuralEq for BehaviorInstance
impl StructuralPartialEq for BehaviorInstance
Auto Trait Implementations
impl RefUnwindSafe for BehaviorInstance
impl !Send for BehaviorInstance
impl !Sync for BehaviorInstance
impl Unpin for BehaviorInstance
impl UnwindSafe for BehaviorInstance
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more