Struct event_driven_library::prelude::UnitOfWork
source · pub struct UnitOfWork<R, E>where
R: TRepository<E>,
E: Executor,{
pub repository: R,
/* private fields */
}Fields§
§repository: RImplementations§
source§impl<R, E> UnitOfWork<R, E>where
R: TRepository<E>,
E: Executor,
impl<R, E> UnitOfWork<R, E>where R: TRepository<E>, E: Executor,
sourcepub async fn new(
context: Arc<RwLock<ContextManager>, Global>
) -> impl Future<Output = UnitOfWork<R, E>>
pub async fn new( context: Arc<RwLock<ContextManager>, Global> ) -> impl Future<Output = UnitOfWork<R, E>>
Creating Uow means to begin transaction.
pub fn switch_repository<DR>(self) -> UnitOfWork<DR, E>where DR: TRepository<E>,
pub fn repository(&mut self) -> &mut R
pub async fn begin(&mut self) -> impl Future<Output = Result<(), BaseError>>
pub fn executor(&self) -> Arc<RwLock<E>, Global>
pub async fn commit<O>(self) -> impl Future<Output = Result<(), BaseError>>where O: IOutBox<E>,
pub async fn rollback(self) -> impl Future<Output = Result<(), BaseError>>
Trait Implementations§
source§impl<R, E> Clone for UnitOfWork<R, E>where
R: Clone + TRepository<E>,
E: Clone + Executor,
impl<R, E> Clone for UnitOfWork<R, E>where R: Clone + TRepository<E>, E: Clone + Executor,
source§fn clone(&self) -> UnitOfWork<R, E>
fn clone(&self) -> UnitOfWork<R, E>
Returns a copy 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 moreAuto Trait Implementations§
impl<R, E> !RefUnwindSafe for UnitOfWork<R, E>
impl<R, E> Send for UnitOfWork<R, E>where E: Send + Sync, R: Send,
impl<R, E> Sync for UnitOfWork<R, E>where E: Send + Sync, R: Sync,
impl<R, E> Unpin for UnitOfWork<R, E>where R: Unpin,
impl<R, E> !UnwindSafe for UnitOfWork<R, E>
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.