pub struct MaterialGenerator { /* private fields */ }Expand description
Generator for material master data.
Implementations§
Source§impl MaterialGenerator
impl MaterialGenerator
Sourcepub fn with_config(seed: u64, config: MaterialGeneratorConfig) -> Self
pub fn with_config(seed: u64, config: MaterialGeneratorConfig) -> Self
Create a new material generator with custom configuration.
Sourcepub fn set_country_pack(&mut self, pack: CountryPack)
pub fn set_country_pack(&mut self, pack: CountryPack)
Set the country pack for locale-aware generation.
Sourcepub fn set_template_provider(&mut self, provider: SharedTemplateProvider)
pub fn set_template_provider(&mut self, provider: SharedTemplateProvider)
Set a template provider so user-supplied material descriptions override the embedded pool. (v3.2.1+)
When None (default), the embedded MATERIAL_DESCRIPTIONS pool
is used — byte-identical to pre-v3.2.1 output.
Sourcepub fn set_counter_offset(&mut self, offset: usize)
pub fn set_counter_offset(&mut self, offset: usize)
Set a counter offset so that generated IDs start after a given value.
This is used when generating materials for multiple companies in parallel to ensure globally unique IDs. For example, if company 0 generates 100 materials (MAT-000001..MAT-000100), company 1 should set offset=100 so its materials start at MAT-000101.
Sourcepub fn generate_material(
&mut self,
_company_code: &str,
_effective_date: NaiveDate,
) -> Material
pub fn generate_material( &mut self, _company_code: &str, _effective_date: NaiveDate, ) -> Material
Generate a single material.
Sourcepub fn generate_material_of_type(
&mut self,
material_type: MaterialType,
_company_code: &str,
_effective_date: NaiveDate,
) -> Material
pub fn generate_material_of_type( &mut self, material_type: MaterialType, _company_code: &str, _effective_date: NaiveDate, ) -> Material
Generate a material with specific type.
Sourcepub fn generate_material_with_bom(
&mut self,
company_code: &str,
effective_date: NaiveDate,
component_count: usize,
) -> Material
pub fn generate_material_with_bom( &mut self, company_code: &str, effective_date: NaiveDate, component_count: usize, ) -> Material
Generate a material with BOM.
Sourcepub fn generate_material_pool(
&mut self,
count: usize,
company_code: &str,
effective_date: NaiveDate,
) -> MaterialPool
pub fn generate_material_pool( &mut self, count: usize, company_code: &str, effective_date: NaiveDate, ) -> MaterialPool
Generate a material pool with specified count.
Sourcepub fn generate_material_pool_with_bom(
&mut self,
count: usize,
bom_rate: f64,
company_code: &str,
effective_date: NaiveDate,
) -> MaterialPool
pub fn generate_material_pool_with_bom( &mut self, count: usize, bom_rate: f64, company_code: &str, effective_date: NaiveDate, ) -> MaterialPool
Generate a material pool with BOMs.
Auto Trait Implementations§
impl !RefUnwindSafe for MaterialGenerator
impl !UnwindSafe for MaterialGenerator
impl Freeze for MaterialGenerator
impl Send for MaterialGenerator
impl Sync for MaterialGenerator
impl Unpin for MaterialGenerator
impl UnsafeUnpin for MaterialGenerator
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
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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.