pub struct Entity(/* private fields */);Expand description
An entity represents a unique thing within a collection. Entity can only be constructed via a WeakEntitySet which provides duplication guarantees.
Implementations§
Source§impl Entity
impl Entity
pub fn id(&self) -> EntityId
pub fn collection(&self) -> &CollectionId
pub fn head(&self) -> Clock
Sourcepub fn is_writable(&self) -> bool
pub fn is_writable(&self) -> bool
Check if this entity is writable (i.e., it’s a transaction fork that’s still alive)
pub fn to_state(&self) -> Result<State, StateError>
pub fn to_entity_state(&self) -> Result<EntityState, StateError>
pub fn create(id: EntityId, collection: CollectionId) -> Self
pub fn view<V: View>(&self) -> Option<V>
Sourcepub async fn apply_event<G>(
&self,
getter: &G,
event: &Event,
) -> Result<bool, MutationError>
pub async fn apply_event<G>( &self, getter: &G, event: &Event, ) -> Result<bool, MutationError>
Attempt to apply an event to the entity
pub async fn apply_state<G>( &self, getter: &G, state: &State, ) -> Result<bool, MutationError>
Sourcepub fn snapshot(&self, trx_alive: Arc<AtomicBool>) -> Self
pub fn snapshot(&self, trx_alive: Arc<AtomicBool>) -> Self
Create a snapshot of the Entity which is detached from this one, and will not receive the updates this one does The trx_alive parameter tracks whether the transaction that owns this snapshot is still alive
Sourcepub fn broadcast(&self) -> &Broadcast
pub fn broadcast(&self) -> &Broadcast
Get a reference to the entity’s broadcast for Signal implementations
Sourcepub fn get_backend<P: PropertyBackend>(&self) -> Result<Arc<P>, RetrievalError>
pub fn get_backend<P: PropertyBackend>(&self) -> Result<Arc<P>, RetrievalError>
Get a specific backend, creating it if it doesn’t exist
pub fn values(&self) -> Vec<(String, Option<Value>)>
Trait Implementations§
Source§impl AbstractEntity for Entity
impl AbstractEntity for Entity
Source§impl Filterable for Entity
impl Filterable for Entity
Source§impl<SE, PA> GapFetcher<Entity> for QueryGapFetcher<SE, PA>where
SE: StorageEngine + 'static,
PA: PolicyAgent + 'static,
impl<SE, PA> GapFetcher<Entity> for QueryGapFetcher<SE, PA>where
SE: StorageEngine + 'static,
PA: PolicyAgent + 'static,
Source§fn fetch_gap<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
collection_id: &'life1 CollectionId,
selection: &'life2 Selection,
last_entity: Option<&'life3 Entity>,
gap_size: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Entity>, RetrievalError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn fetch_gap<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
collection_id: &'life1 CollectionId,
selection: &'life2 Selection,
last_entity: Option<&'life3 Entity>,
gap_size: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Entity>, RetrievalError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Fetch entities to fill a gap in a limited result set Read more
Auto Trait Implementations§
impl Freeze for Entity
impl RefUnwindSafe for Entity
impl Send for Entity
impl Sync for Entity
impl Unpin for Entity
impl UnwindSafe for Entity
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.