pub struct ScriptHandle<P> { /* private fields */ }Expand description
A typed handle for scheduling a script with specific parameters.
Created by the #[chronon::script] macro. The attribute turns the annotated
function into a handle factory (fn nightly_cleanup() -> ScriptHandle<…>) and
moves the body to an internal __*_impl entry point used by the executor.
After building a Job, set crate::ScheduleKind / cron fields and upsert via
CoordinatorService (Mode 1–2) or RemoteCoordinatorClient (Mode 3).
§Examples
Build a default Job from the macro-generated handle, then upsert it:
use chronon_core::{Job, ScriptHandle};
use serde::Serialize;
#[derive(Serialize)]
struct NightlyCleanupParams {
retention_days: u32,
}
let handle = ScriptHandle::<NightlyCleanupParams>::new("nightly_cleanup");
let job: Job = handle
.job_with_params(
"nightly-job",
&NightlyCleanupParams {
retention_days: 7,
},
)
.expect("params serialize");
assert_eq!(job.script_name, "nightly_cleanup");
assert_eq!(job.params_json["retention_days"], 7);Runnable end-to-end sample: cargo run -p uf-chronon --example script_handle_job --features mem.
Implementations§
Trait Implementations§
Source§impl<P: Clone> Clone for ScriptHandle<P>
impl<P: Clone> Clone for ScriptHandle<P>
Source§fn clone(&self) -> ScriptHandle<P>
fn clone(&self) -> ScriptHandle<P>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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<P> Freeze for ScriptHandle<P>
impl<P> RefUnwindSafe for ScriptHandle<P>where
P: RefUnwindSafe,
impl<P> Send for ScriptHandle<P>where
P: Send,
impl<P> Sync for ScriptHandle<P>where
P: Sync,
impl<P> Unpin for ScriptHandle<P>where
P: Unpin,
impl<P> UnsafeUnpin for ScriptHandle<P>
impl<P> UnwindSafe for ScriptHandle<P>where
P: UnwindSafe,
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