laravel-rust 0.1.0

Laravel for Rust: a full-stack Rust web framework, inspired by PHP Laravel
Documentation
//! Durable workflows: a flow of steps written as one async function, which survives deploys,
//! worker crashes, and sleeps of days in between.
//!
//! A workflow is a [`Queueable`](crate::queue::Queueable) struct with a [`#[workflow]`](macro@workflow)
//! impl. Its `handle` takes a [`&Run`](Run), and every durable operation is a method on the run.
//! Each step runs once, and the framework records its result in a [store](store::Store), so a
//! run that stops for any reason continues from the last recorded step:
//!
//! ```no_run
//! use laravel::queue::Queueable;
//! use laravel::time::ToSpan;
//! use laravel::workflow::{Run, workflow};
//!
//! #[derive(Queueable)]
//! pub struct OnboardUser {
//!     pub user_id: i64,
//! }
//!
//! #[workflow]
//! impl OnboardUser {
//!     async fn handle(self, run: &Run) -> laravel::Result<()> {
//!         run.step("send welcome email", self.send_welcome_email()).await?;
//!
//!         run.sleep(3.days()).await?;
//!
//!         run.step("send tips", self.send_tips()).await
//!     }
//! }
//!
//! impl OnboardUser {
//!     async fn send_welcome_email(&self) -> laravel::Result<()> {
//!         // ...
//!         Ok(())
//!     }
//!
//!     async fn send_tips(&self) -> laravel::Result<()> {
//!         // ...
//!         Ok(())
//!     }
//! }
//!
//! # async fn example() -> laravel::Result<()> {
//! let run_id = OnboardUser { user_id: 42 }.start().await?;
//! # Ok(()) }
//! ```
//!
//! Each advance of a run is a job on the application's queue, so runs need a queue worker. The
//! [workflows guide](https://github.com/laravel/rust-framework/blob/0.x/docs/workflows.md) describes
//! replays, determinism rules, and testing.

pub(crate) use laravel_workflow::workflow::*;
#[doc(hidden)]
pub use laravel_workflow::workflow::{__Registration, __WorkflowResult, TakesResume};
#[doc(inline)]
pub use laravel_workflow::workflow::{
    CurrentStep, Drivers, Inbox, PendingCancel, PendingStart, Resume, ResumeUrl, Resumed, Run, RunId, RunInfo, Sleep,
    Started, Status, Step, StepFailed, StepInfo, StoreDefinition, TimedWait, Token, Wait, Workflow, WorkflowFake,
    cancel, current_step, events, fake, fatal, find, resume, resume_url, retry_after, store, waiting_for, webhook_url,
    workflow,
};

/// Define a migration's `migrate` function to create the `database` workflow store's tables.
///
/// Put the macro alone in a migration file, and it creates the `workflow_runs`, `workflow_steps`,
/// `workflow_waits`, `workflow_resumes`, and `workflow_attributes` tables. To change the
/// tables, replace the macro with the migration the
/// [workflows guide](https://github.com/laravel/rust-framework/blob/0.x/docs/workflows.md#the-workflow-tables) shows,
/// then edit it.
///
/// ```
/// // database/migrations/0001_01_01_000003_create_workflow_tables.rs
/// laravel::workflow::tables!();
/// ```
#[cfg(feature = "database")]
pub use laravel_rust_database_macros::workflow_tables as tables;