pub struct RunId(pub Ulid);Expand description
A single execution: one goal, one plan, one lifetime.
Runs stay short by design — longevity lives in the CaseId, so a
six-week business process never pins a code version.
§One spelling, everywhere
Prefixed (run_01J8Z…) in every direction:
Display, Serialize, the store key, the
column. An id is self-describing wherever it lands — a log line, a
URL, a JSON field, a SIEM — and grepping one against another finds
it whichever way round you do it.
What this rules out is a store spelling one id two ways — prefixed in its keys and bare in its payloads — which costs a consumer an afternoon and looks like two ids until it does.
Deserialize and parse accept a bare ULID too,
because one arrives from somewhere else often enough. The prefix is
checked rather than stripped blindly, so a case_… string is refused
where a RunId is wanted instead of silently becoming one.
Tuple Fields§
§0: UlidImplementations§
Source§impl RunId
impl RunId
Sourcepub fn generate() -> Self
pub fn generate() -> Self
Mint a fresh id from the ambient clock and a random tail.
Reserved for the runtime’s admission path, which journals the
result. Skills must never call this — see clippy.toml.
Sorted to the millisecond, not beyond it. Ordering comes from the timestamp prefix, so two ids minted in the same millisecond order by their random tails — arbitrarily, and differently on each instance. A range scan over one run’s records is exact because the run id is a prefix; “cases sort by creation time” is true between milliseconds and a coin flip inside one.
Sourcepub fn parse(s: &str) -> Result<Self, DecodeError>
pub fn parse(s: &str) -> Result<Self, DecodeError>
Reconstruct from a stored string.
Accepts both the prefixed form produced by std::fmt::Display
and a bare ULID, so ids round-trip through logs, URLs, and
database columns without the caller having to know which form it
is holding.
§Errors
If what remains after the prefix is not a ULID.
Trait Implementations§
impl Copy for RunId
Source§impl<'de> Deserialize<'de> for RunId
Through parse, so a bare ULID from somewhere else
still reads.
impl<'de> Deserialize<'de> for RunId
Through parse, so a bare ULID from somewhere else
still reads.
A refusal names the type and the input: ulid’s own error is
invalid length, which says nothing about which field was wrong or
what it wanted.
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
impl Eq for RunId
Source§impl FromStr for RunId
The trait an id arrives through: an axum path segment, a clap
argument, a TOML key, a serde field with #[serde(with = …)].
impl FromStr for RunId
The trait an id arrives through: an axum path segment, a clap
argument, a TOML key, a serde field with #[serde(with = …)].
.parse() is where every consumer reaches first, and its absence
made parse something each of them had to find.
Source§impl Ord for RunId
impl Ord for RunId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for RunId
impl PartialOrd for RunId
impl StructuralPartialEq for RunId
Auto Trait Implementations§
impl Freeze for RunId
impl RefUnwindSafe for RunId
impl Send for RunId
impl Sync for RunId
impl Unpin for RunId
impl UnsafeUnpin for RunId
impl UnwindSafe for RunId
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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