pub struct Kernel { /* private fields */ }Expand description
A booted application: its router, database, queue and maintenance commands.
Implementations§
Source§impl Kernel
impl Kernel
Sourcepub async fn call(
&self,
name: &str,
args: impl IntoIterator<Item = impl Into<String>>,
) -> Result
pub async fn call( &self, name: &str, args: impl IntoIterator<Item = impl Into<String>>, ) -> Result
Runs the app command name (see App::command), e.g. from a test.
Sourcepub async fn run_scheduled(&self, name: &str) -> Result
pub async fn run_scheduled(&self, name: &str) -> Result
Runs the scheduled task name now, with its hooks (what
schedule:run does). In a test, TestApp::run_scheduled does the same
at the time TestApp::travel moved the clock to.
Sourcepub fn router(&self) -> Router
pub fn router(&self) -> Router
The assembled router, e.g. to drive with tower::ServiceExt::oneshot.
Sourcepub fn mailer(&self) -> &Mailer
pub fn mailer(&self) -> &Mailer
The mailer; with MAIL_MAILER=memory, mailer().sent() lists what was sent.
Sourcepub fn worker(&self, queues: Vec<String>) -> Worker
pub fn worker(&self, queues: Vec<String>) -> Worker
A worker for the given queues (all queues when empty).
Sourcepub async fn run_jobs(&self) -> Result<usize>
pub async fn run_jobs(&self) -> Result<usize>
Runs every job that is available now, e.g. in tests; returns how many ran.
Sourcepub async fn serve(self) -> Result
pub async fn serve(self) -> Result
Serves HTTP with queue workers and the scheduler in the same process, until Ctrl-C or SIGTERM; then lets running jobs finish.
Sourcepub async fn migrate(&self) -> Result<Vec<String>>
pub async fn migrate(&self) -> Result<Vec<String>>
Runs pending migrations; returns their names.
Sourcepub async fn rollback(&self, batches: u32) -> Result<Vec<String>>
pub async fn rollback(&self, batches: u32) -> Result<Vec<String>>
Undoes the last batches batches of migrations; returns their names.
Sourcepub async fn migration_status(&self) -> Result<Vec<MigrationStatus>>
pub async fn migration_status(&self) -> Result<Vec<MigrationStatus>>
Every migration and whether it has run, as migrate:status prints them.
Auto Trait Implementations§
impl !RefUnwindSafe for Kernel
impl !UnwindSafe for Kernel
impl Freeze for Kernel
impl Send for Kernel
impl Sync for Kernel
impl Unpin for Kernel
impl UnsafeUnpin for Kernel
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> ⓘ
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> ⓘ
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