Skip to main content

Store

Struct Store 

Source
pub struct Store<T> { /* private fields */ }

Implementations§

Source§

impl<T> Store<T>

Source

pub fn untracked() -> Self

Source

pub fn tracked(capacity: LogCapacity) -> Self

Source

pub fn is_tracked(&self) -> bool

Source

pub fn log_capacity(&self) -> Option<LogCapacity>

Source

pub fn scene(&self) -> SceneId

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn contains(&self, entity: Entity) -> bool

Source

pub fn dense_index(&self, entity: Entity) -> Option<usize>

Stable between structural boundaries and meaningless across them.

Source

pub fn entity_at(&self, dense: usize) -> Option<Entity>

Source

pub fn get(&self, entity: Entity) -> Option<&T>

Source

pub fn get_mut(&mut self, entity: Entity) -> Option<&mut T>

Source

pub fn pair_mut(&mut self, a: Entity, b: Entity) -> Option<(&mut T, &mut T)>

Two disjoint mutable rows of one store; equal handles yield None.

Source

pub fn rows(&self) -> &[T]

Source

pub fn iter(&self) -> impl Iterator<Item = (Entity, &T)>

Source

pub fn iter_mut(&mut self) -> impl Iterator<Item = (Entity, &mut T)>

Source

pub fn insert( &mut self, entities: &Entities, entity: Entity, row: T, ) -> Result<(), StoreError>

Source

pub fn remove(&mut self, entity: Entity) -> Result<T, StoreError>

Source

pub fn partition<'a>( &'a mut self, cuts: &'a [usize], ) -> Result<Partition<'a, T>, PartitionError>

cuts must be strictly ascending and within len.

Source

pub fn boundary(&mut self)

Counts toward cursor expiry; the session calls it once per boundary.

Source

pub fn version(&self, entity: Entity) -> Option<Version>

None for an untracked store or an entity it does not hold.

Source

pub fn changes(&self, cursor: &mut Cursor) -> Changes<'_, T> ⓘ

Source

pub fn changed_since(&self, cursor: &mut Cursor) -> bool

An untracked store or an expired cursor counts as changed; a clean check renews the cursor’s expiry.

Source

pub fn catch_up(&self, cursor: &mut Cursor)

Trait Implementations§

Source§

impl<T> Default for Store<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T: Clone + Send + 'static> StoreField for Store<T>

Source§

type Snapshot = StoreSnapshot<T>

Source§

fn bind(&mut self, scene: SceneId, _owner: Owner)

Source§

fn snapshot(&self) -> StoreSnapshot<T>

Source§

fn restore(&mut self, from: &StoreSnapshot<T>, scene: SceneId, _owner: Owner)

Source§

fn boundary(&mut self, _owner: Owner)

Source§

fn release(&mut self, entity: Entity, _owner: Owner)

Auto Trait Implementations§

§

impl<T> !Freeze for Store<T>

§

impl<T> RefUnwindSafe for Store<T>
where T: RefUnwindSafe,

§

impl<T> Send for Store<T>
where T: Send,

§

impl<T> Sync for Store<T>
where T: Sync,

§

impl<T> Unpin for Store<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Store<T>

§

impl<T> UnwindSafe for Store<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more