Skip to main content

StoreBatch

Struct StoreBatch 

Source
pub struct StoreBatch<'a, S: Store> { /* private fields */ }
Expand description

A synchronous batch bound to one mounted store. Dropping it discards its prepared changes.

Implementations§

Source§

impl<S: Store> StoreBatch<'_, S>

Source

pub fn insert<E: Entity<Store = S>>(&mut self, row: &E) -> Result<(), Error>

Queue an insertion in this store.

§Errors

Propagates Batch::insert admission errors.

Source

pub fn insert_input<I: InsertInput<Entity: Entity<Store = S>>>( &mut self, input: I, ) -> Result<I::Entity, Error>

Queue an insertion using the entity’s generated input and return the prepared row.

§Errors

Propagates Batch::insert_input admission errors.

Source

pub fn replace<E: Entity<Store = S>>(&mut self, row: &E) -> Result<(), Error>

Queue a replacement in this store.

§Errors

Propagates Batch::replace admission errors.

Source

pub fn delete<E: Entity<Store = S>>( &mut self, key: impl Into<Id<E>>, ) -> Result<(), Error>

Queue a deletion in this store.

§Errors

Propagates Batch::delete admission errors.

Source

pub fn commit(self) -> Result<(), Error>

Apply the prepared changes through the owning store session.

§Errors

Propagates DatabaseSession::commit borrow and commit errors.

Source

pub fn commit_returning<E: Entity<Store = S>>( self, key: impl Into<Id<E>>, ) -> Result<E, Error>

Commit all queued changes and return one inserted or replaced row from this store.

§Errors

Propagates DatabaseSession::commit_returning borrow, selection and commit errors.

Auto Trait Implementations§

§

impl<'a, S> !RefUnwindSafe for StoreBatch<'a, S>

§

impl<'a, S> !Send for StoreBatch<'a, S>

§

impl<'a, S> !Sync for StoreBatch<'a, S>

§

impl<'a, S> !UnwindSafe for StoreBatch<'a, S>

§

impl<'a, S> Forget for StoreBatch<'a, S>

§

impl<'a, S> Freeze for StoreBatch<'a, S>
where PhantomData<fn() -> S>: Freeze,

§

impl<'a, S> Move for StoreBatch<'a, S>

§

impl<'a, S> Unpin for StoreBatch<'a, S>
where PhantomData<fn() -> S>: Unpin,

§

impl<'a, S> UnsafeUnpin for StoreBatch<'a, S>
where PhantomData<fn() -> S>: UnsafeUnpin,

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.

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.