pub struct WeakEntitySet(/* private fields */);Expand description
A set of entities held weakly
Implementations§
Source§impl WeakEntitySet
impl WeakEntitySet
pub fn get(&self, id: &EntityId) -> Option<Entity>
pub async fn get_or_retrieve<R>( &self, retriever: &R, collection_id: &CollectionId, id: &EntityId, ) -> Result<Option<Entity>, RetrievalError>
Sourcepub async fn get_retrieve_or_create<R>(
&self,
retriever: &R,
collection_id: &CollectionId,
id: &EntityId,
) -> Result<Entity, RetrievalError>
pub async fn get_retrieve_or_create<R>( &self, retriever: &R, collection_id: &CollectionId, id: &EntityId, ) -> Result<Entity, RetrievalError>
Returns a resident entity, or fetches it from storage, or finally creates if neither of the two are found
Sourcepub fn create(&self, collection: CollectionId) -> Entity
pub fn create(&self, collection: CollectionId) -> Entity
Create a brand new entity, and add it to the set
Sourcepub async fn with_state<R>(
&self,
retriever: &R,
id: EntityId,
collection_id: CollectionId,
state: State,
) -> Result<(Option<bool>, Entity), RetrievalError>
pub async fn with_state<R>( &self, retriever: &R, id: EntityId, collection_id: CollectionId, state: State, ) -> Result<(Option<bool>, Entity), RetrievalError>
Returns a tuple of (changed, entity) changed is Some(true) if the entity was changed, Some(false) if it already exists and the state was not applied None if the entity was not previously on the local node (either in the WeakEntitySet or in storage)
Trait Implementations§
Source§impl Clone for WeakEntitySet
impl Clone for WeakEntitySet
Source§fn clone(&self) -> WeakEntitySet
fn clone(&self) -> WeakEntitySet
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 Default for WeakEntitySet
impl Default for WeakEntitySet
Source§fn default() -> WeakEntitySet
fn default() -> WeakEntitySet
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for WeakEntitySet
impl RefUnwindSafe for WeakEntitySet
impl Send for WeakEntitySet
impl Sync for WeakEntitySet
impl Unpin for WeakEntitySet
impl UnsafeUnpin for WeakEntitySet
impl UnwindSafe for WeakEntitySet
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.