pub struct MigrationsWorker<DB>{ /* private fields */ }Expand description
An asynchronous worker that applies database migrations in the background
and signals completion to whoever cares to listen via the returned Gate.
Implementations§
Source§impl<DB> MigrationsWorker<DB>
impl<DB> MigrationsWorker<DB>
Sourcepub async fn start(
name: impl AsRef<str>,
migrator: &'static Migrator,
pool: Pool<DB>,
) -> Gate
pub async fn start( name: impl AsRef<str>, migrator: &'static Migrator, pool: Pool<DB>, ) -> Gate
Starts applying migrations using the given static reference to a
migrator and the given pool of database
connections. The given name is attached to this MigrationsWorker
for logging/alerting purposes.
The returned Gate can be used to await for the migrations to be
successfully applied.
Auto Trait Implementations§
impl<DB> !Freeze for MigrationsWorker<DB>
impl<DB> !RefUnwindSafe for MigrationsWorker<DB>
impl<DB> Send for MigrationsWorker<DB>
impl<DB> Sync for MigrationsWorker<DB>
impl<DB> Unpin for MigrationsWorker<DB>
impl<DB> !UnwindSafe for MigrationsWorker<DB>
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> 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 more