pub enum EntityEvents {
Created,
Updated,
Deleted,
}Expand description
Events that can occur to entities during replay parsing.
These events are passed to the Observer::on_entity callback when
an entity is created, updated, or deleted.
§Examples
use source2_demo::prelude::*;
#[derive(Default)]
struct EntityTracker {
created: usize,
updated: usize,
deleted: usize,
}
#[observer]
#[uses_entities]
impl Observer for EntityTracker {
fn on_entity(&mut self, ctx: &Context, event: EntityEvents, entity: &Entity) -> ObserverResult {
match event {
EntityEvents::Created => self.created += 1,
EntityEvents::Updated => self.updated += 1,
EntityEvents::Deleted => self.deleted += 1,
}
Ok(())
}
}Variants§
Created
Entity was created and added
Updated
Entity properties were updated
Deleted
Entity was removed
Trait Implementations§
Source§impl Clone for EntityEvents
impl Clone for EntityEvents
Source§fn clone(&self) -> EntityEvents
fn clone(&self) -> EntityEvents
Returns a duplicate 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 EntityEvents
impl Debug for EntityEvents
Source§impl PartialEq for EntityEvents
impl PartialEq for EntityEvents
impl Copy for EntityEvents
impl Eq for EntityEvents
impl StructuralPartialEq for EntityEvents
Auto Trait Implementations§
impl Freeze for EntityEvents
impl RefUnwindSafe for EntityEvents
impl Send for EntityEvents
impl Sync for EntityEvents
impl Unpin for EntityEvents
impl UnsafeUnpin for EntityEvents
impl UnwindSafe for EntityEvents
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.