pub struct NumberScheme { /* private fields */ }Expand description
A numbering scheme for generated item numbers, e.g.
{PROJECT}-{TYPE}-{YYYY}-{SEQ:4} → ROVER-PRT-2026-0007.
Placeholders: {PROJECT} (project code), {TYPE} (PRT, ASM, DOC, SW, SIM, AB),
{YYYY}, {YY}, {MM} (creation date, UTC) and exactly one {SEQ:n}
(sequence, zero-padded to n digits; {SEQ} pads nothing). Everything
else is literal text from the item-number alphabet A–Z 0–9 . _ -.
Each distinct expansion of the scheme without the sequence counts on its
own: {PROJECT}-{SEQ:4} counts per project group, a scheme with {YYYY}
starts at 1 every year, a scheme without {TYPE} shares one sequence
between all item types.
Implementations§
Source§impl NumberScheme
impl NumberScheme
Sourcepub fn parse(raw: &str) -> Result<NumberScheme, AppError>
pub fn parse(raw: &str) -> Result<NumberScheme, AppError>
Parses and validates a scheme; placeholders are case-insensitive and the literal text is upper-cased like item numbers.
Sourcepub fn default_scheme() -> NumberScheme
pub fn default_scheme() -> NumberScheme
The built-in scheme {TYPE}-{SEQ:6}.
Sourcepub fn of_project(stored: Option<&str>) -> Result<NumberScheme, AppError>
pub fn of_project(stored: Option<&str>) -> Result<NumberScheme, AppError>
The stored scheme of a project group, or the default.
Sourcepub fn counter_key(&self, ctx: &NumberContext<'_>) -> String
pub fn counter_key(&self, ctx: &NumberContext<'_>) -> String
Name of the counter that numbers this expansion: everything but the
sequence filled in, e.g. num:ROVER-PRT-2026-{SEQ}. The padding width
is not part of it, so widening {SEQ:4} to {SEQ:6} keeps counting.
Sourcepub fn format(&self, ctx: &NumberContext<'_>, seq: i64) -> String
pub fn format(&self, ctx: &NumberContext<'_>, seq: i64) -> String
The item number for sequence value seq.
Sourcepub fn around_seq(&self, ctx: &NumberContext<'_>) -> (String, String)
pub fn around_seq(&self, ctx: &NumberContext<'_>) -> (String, String)
The expansion before and after the sequence, e.g. ROVER-PRT-2026-
and `` for {PROJECT}-{TYPE}-{YYYY}-{SEQ:4}.
Trait Implementations§
Source§impl Clone for NumberScheme
impl Clone for NumberScheme
Source§impl Debug for NumberScheme
impl Debug for NumberScheme
impl Eq for NumberScheme
Source§impl PartialEq for NumberScheme
impl PartialEq for NumberScheme
impl StructuralPartialEq for NumberScheme
Auto Trait Implementations§
impl Freeze for NumberScheme
impl RefUnwindSafe for NumberScheme
impl Send for NumberScheme
impl Sync for NumberScheme
impl Unpin for NumberScheme
impl UnsafeUnpin for NumberScheme
impl UnwindSafe for NumberScheme
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 moreimpl<T> Parallelizable for T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.