pub struct ReferenceGenerator { /* private fields */ }Expand description
Generator for reference numbers.
Implementations§
Source§impl ReferenceGenerator
impl ReferenceGenerator
Sourcepub fn with_company_code(self, code: &str) -> Self
pub fn with_company_code(self, code: &str) -> Self
Set the company code.
Sourcepub fn set_config(&mut self, ref_type: ReferenceType, config: ReferenceConfig)
pub fn set_config(&mut self, ref_type: ReferenceType, config: ReferenceConfig)
Set configuration for a reference type.
Sourcepub fn set_prefix(&mut self, ref_type: ReferenceType, prefix: &str)
pub fn set_prefix(&mut self, ref_type: ReferenceType, prefix: &str)
Set a custom prefix for a reference type.
Sourcepub fn generate(&mut self, ref_type: ReferenceType) -> String
pub fn generate(&mut self, ref_type: ReferenceType) -> String
Generate a reference number.
Sourcepub fn generate_for_year(
&mut self,
ref_type: ReferenceType,
year: i32,
) -> String
pub fn generate_for_year( &mut self, ref_type: ReferenceType, year: i32, ) -> String
Generate a reference number for a specific year.
Sourcepub fn generate_for_process(&mut self, process: BusinessProcess) -> String
pub fn generate_for_process(&mut self, process: BusinessProcess) -> String
Generate a reference for a business process.
Sourcepub fn generate_for_process_year(
&mut self,
process: BusinessProcess,
year: i32,
) -> String
pub fn generate_for_process_year( &mut self, process: BusinessProcess, year: i32, ) -> String
Generate a reference for a business process and year.
Sourcepub fn generate_external_reference(&self, rng: &mut impl Rng) -> String
pub fn generate_external_reference(&self, rng: &mut impl Rng) -> String
Generate an external reference (vendor invoice, etc.) with random elements.
Trait Implementations§
Source§impl Debug for ReferenceGenerator
impl Debug for ReferenceGenerator
Auto Trait Implementations§
impl Freeze for ReferenceGenerator
impl RefUnwindSafe for ReferenceGenerator
impl Send for ReferenceGenerator
impl Sync for ReferenceGenerator
impl Unpin for ReferenceGenerator
impl UnsafeUnpin for ReferenceGenerator
impl UnwindSafe for ReferenceGenerator
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
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.