pub struct RustvelloBuilder { /* private fields */ }Expand description
Fluent builder for constructing a [RustvelloApp].
Provides an ergonomic API for configuring backends, loading settings from environment variables or TOML files, and applying dev-mode presets.
§Priority order (highest wins)
- Programmatic — explicit builder method calls
- Environment variables — always read automatically
- Config file — via
from_file() - pyproject.toml —
[tool.rustvello.app] - Defaults
§Examples
use rustvello::prelude::*;
// Minimal in-memory defaults
let app = Rustvello::builder()
.app_id("my-app")
.build().await?;Implementations§
Source§impl RustvelloBuilder
impl RustvelloBuilder
Sourcepub async fn build(self) -> RustvelloResult<RustvelloApp>
pub async fn build(self) -> RustvelloResult<RustvelloApp>
Consume the builder and produce a RustvelloApp.
Establishes all backend connections (database, Redis, etc.) that were
configured via preset methods like .sqlite(),
.redis(), or .postgres().
If no backends were explicitly provided, falls back to:
- In-memory backends (when the
memfeature is enabled) - Error otherwise
If auto_discover_tasks() was called, all tasks registered via
#[rustvello::task] are automatically added to the registry.
Additionally, any task modules added via task_module() are
registered.
Source§impl RustvelloBuilder
impl RustvelloBuilder
Sourcepub fn memory(self) -> Self
Available on crate feature mem only.
pub fn memory(self) -> Self
mem only.Use all in-memory backends (suitable for testing and development).
No connections are established — backends are created during
build().
Sourcepub fn sqlite(self, path: &str, app_id: &str) -> Self
Available on crate feature sqlite only.
pub fn sqlite(self, path: &str, app_id: &str) -> Self
sqlite only.Use all SQLite backends with the given database path.
The database file is opened during build(), not here.
Sourcepub fn mongodb(self, uri: &str, db_name: &str, app_id: &str) -> Self
Available on crate feature mongodb only.
pub fn mongodb(self, uri: &str, db_name: &str, app_id: &str) -> Self
mongodb only.Sourcepub fn rabbitmq(self, uri: &str, prefix: &str) -> Self
Available on crate feature rabbitmq only.
pub fn rabbitmq(self, uri: &str, prefix: &str) -> Self
rabbitmq only.Use a RabbitMQ broker with the given AMQP URI and queue prefix.
Only sets the broker — orchestrator, state backend, client data store,
and trigger store must be provided separately (e.g. via .redis() or
.sqlite()). This matches the Python pynenc_rabbitmq plugin which
only provides a broker implementation.
The connection is established during build(), not here.
§Examples
let app = Rustvello::builder()
.rabbitmq("amqp://localhost:5672", "myapp")
.redis("redis://127.0.0.1/", "my_app")
.build().await?;Sourcepub fn postgres(self, connection_string: &str, app_id: &str) -> Self
Available on crate feature postgres only.
pub fn postgres(self, connection_string: &str, app_id: &str) -> Self
postgres only.Sourcepub fn postgres_tls(self, connection_string: &str, app_id: &str) -> Self
Available on crate features postgres and tls only.
pub fn postgres_tls(self, connection_string: &str, app_id: &str) -> Self
postgres and tls only.Use all PostgreSQL backends with TLS encryption.
Requires both the postgres and tls features.
Source§impl RustvelloBuilder
impl RustvelloBuilder
Sourcepub fn max_pending_seconds(self, seconds: u64) -> Self
pub fn max_pending_seconds(self, seconds: u64) -> Self
Set the maximum pending time for invocations (in seconds).
Sourcepub fn heartbeat_interval(self, seconds: u64) -> Self
pub fn heartbeat_interval(self, seconds: u64) -> Self
Set the heartbeat interval for runners (in seconds).
Sourcepub fn argument_print_mode(self, mode: ArgumentPrintMode) -> Self
pub fn argument_print_mode(self, mode: ArgumentPrintMode) -> Self
Set the argument print mode (Full, Keys, Truncated, Hidden).
Sourcepub fn hide_arguments(self) -> Self
pub fn hide_arguments(self) -> Self
Hide all argument values in logs and display.
Sourcepub fn truncate_arguments_length(self, length: usize) -> Self
pub fn truncate_arguments_length(self, length: usize) -> Self
Set the maximum length for truncated argument display.
Sourcepub fn runner_dead_after_seconds(self, seconds: u64) -> Self
pub fn runner_dead_after_seconds(self, seconds: u64) -> Self
Set how long (seconds) before a runner without heartbeats is considered dead.
Sourcepub fn recovery_check_interval(self, seconds: u64) -> Self
pub fn recovery_check_interval(self, seconds: u64) -> Self
Set how often (seconds) to scan for stale invocations.
Sourcepub fn cached_status_time(self, seconds: f64) -> Self
pub fn cached_status_time(self, seconds: f64) -> Self
Set the TTL for cached invocation status checks (seconds, 0 = no cache).
Sourcepub fn recover_pending_cron(self, cron: impl Into<String>) -> Self
pub fn recover_pending_cron(self, cron: impl Into<String>) -> Self
Set the cron expression for recovering pending invocations.
Sourcepub fn recover_running_cron(self, cron: impl Into<String>) -> Self
pub fn recover_running_cron(self, cron: impl Into<String>) -> Self
Set the cron expression for recovering running invocations from dead runners.
Sourcepub fn trigger_task_modules(self, modules: Vec<String>) -> Self
pub fn trigger_task_modules(self, modules: Vec<String>) -> Self
Set module paths to scan for trigger task registration.
Sourcepub fn logging_level(self, level: impl Into<String>) -> Self
pub fn logging_level(self, level: impl Into<String>) -> Self
Set the logging level (trace, debug, info, warn, error).
Sourcepub fn log_format(self, format: LogFormat) -> Self
pub fn log_format(self, format: LogFormat) -> Self
Set the log output format (Text or Json).
Sourcepub fn log_use_colors(self, use_colors: Option<bool>) -> Self
pub fn log_use_colors(self, use_colors: Option<bool>) -> Self
Set whether to use ANSI colors in text format (None = auto-detect TTY).
Sourcepub fn compact_log_context(self, compact: bool) -> Self
pub fn compact_log_context(self, compact: bool) -> Self
Set whether to show compact context in logs.
Sourcepub fn blocking_control(self, enabled: bool) -> Self
pub fn blocking_control(self, enabled: bool) -> Self
Set whether the orchestrator uses blocking/waiting semantics.
Sourcepub fn auto_final_invocation_purge_hours(self, hours: f64) -> Self
pub fn auto_final_invocation_purge_hours(self, hours: f64) -> Self
Set hours after which final invocations can be auto-purged (0 = disabled).
Sourcepub fn scheduler_interval(self, seconds: u64) -> Self
pub fn scheduler_interval(self, seconds: u64) -> Self
Set the scheduler evaluation interval in seconds.
Sourcepub fn enable_scheduler(self, enabled: bool) -> Self
pub fn enable_scheduler(self, enabled: bool) -> Self
Set whether the trigger scheduler is enabled.
Sourcepub fn orchestrator(self, orch: Arc<dyn Orchestrator>) -> Self
pub fn orchestrator(self, orch: Arc<dyn Orchestrator>) -> Self
Use a custom orchestrator.
Sourcepub fn state_backend(self, sb: Arc<dyn StateBackend>) -> Self
pub fn state_backend(self, sb: Arc<dyn StateBackend>) -> Self
Use a custom state backend.
Sourcepub fn client_data_store(self, cds: Arc<dyn ClientDataStore>) -> Self
pub fn client_data_store(self, cds: Arc<dyn ClientDataStore>) -> Self
Use a custom client data store backend.
Sourcepub fn client_data_store_config(self, config: ClientDataStoreConfig) -> Self
pub fn client_data_store_config(self, config: ClientDataStoreConfig) -> Self
Configure the client data store manager.
Sourcepub fn auto_discover_tasks(self) -> Self
pub fn auto_discover_tasks(self) -> Self
Auto-discover all tasks registered via #[rustvello::task] at compile time.
Uses the inventory crate to collect all [TaskEntry] instances
submitted by the proc macro. This is the Rust equivalent of pynenc’s
_load_plugins() via entry_points.
Sourcepub fn task_module(self, module: Box<dyn TaskModule>) -> Self
pub fn task_module(self, module: Box<dyn TaskModule>) -> Self
Register a TaskModule — a group of related tasks.
Equivalent to pynenc’s _register_plugin_from_entry_point().
Sourcepub fn trigger_store(self, store: Arc<dyn TriggerStore>) -> Self
pub fn trigger_store(self, store: Arc<dyn TriggerStore>) -> Self
Set a custom trigger store backend.
Sourcepub fn logging(self) -> LoggingBuilder
pub fn logging(self) -> LoggingBuilder
Open the logging & display sub-builder.
let app = Rustvello::builder()
.logging()
.level("debug")
.compact_context(true)
.done()
.build().await?;Sourcepub fn performance(self) -> PerformanceBuilder
pub fn performance(self) -> PerformanceBuilder
Open the performance & scheduling sub-builder.
Sourcepub fn reliability(self) -> ReliabilityBuilder
pub fn reliability(self) -> ReliabilityBuilder
Open the reliability & recovery sub-builder.
Sourcepub fn from_env(self) -> Self
pub fn from_env(self) -> Self
Enable reading environment variables (RUSTVELLO__*) during build().
When called, environment variables are added to the priority chain: programmatic > env > file > defaults.
Sourcepub fn from_file(self, path: impl AsRef<Path>) -> RustvelloResult<Self>
pub fn from_file(self, path: impl AsRef<Path>) -> RustvelloResult<Self>
Load task-section config from a TOML file and register the path for
the cistell resolver to read [app] fields during build().
Reads [task_defaults] and [tasks.<name>] sections immediately.
The [app] section is resolved later via cistell’s FileSource.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RustvelloBuilder
impl !RefUnwindSafe for RustvelloBuilder
impl Send for RustvelloBuilder
impl Sync for RustvelloBuilder
impl Unpin for RustvelloBuilder
impl UnsafeUnpin for RustvelloBuilder
impl !UnwindSafe for RustvelloBuilder
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.