Skip to main content

DefaultTemplateProvider

Struct DefaultTemplateProvider 

Source
pub struct DefaultTemplateProvider { /* private fields */ }
Expand description

Default template provider using embedded templates with optional file overrides.

Implementations§

Source§

impl DefaultTemplateProvider

Source

pub fn new() -> Self

Create a new provider backed by the bundled defaults.yaml.

As of v4.2.4 this is a thin alias for Self::bundled: the YAML bundled via include_str! is the sole source of truth for the default name pools. Parse failure would mean defaults.yaml is malformed, which build.rs validates at compile time — so the .expect below is effectively infallible for any shipped build.

Source

pub fn bundled() -> Result<Self, TemplateError>

Create a provider backed directly by the bundled defaults.yaml (included at compile time via include_str!).

Equivalent to Self::new but surfaces the parse Result for callers that want to handle malformed YAML explicitly (e.g. tests that validate the loader against hand-crafted malformed inputs).

Source

pub fn with_templates( template_data: TemplateData, strategy: MergeStrategy, ) -> Self

Create a provider with user-supplied template data.

The data replaces the bundled defaults wholesale. Callers who want to merge custom content on top of the bundled defaults should start from Self::new and use TemplateLoader::merge / the MergeStrategy::Extend path explicitly.

Source

pub fn from_file(path: &Path) -> Result<Self, TemplateError>

Load templates from a file path.

Source

pub fn from_directory(path: &Path) -> Result<Self, TemplateError>

Load templates from a directory.

Source

pub fn with_merge_strategy(self, strategy: MergeStrategy) -> Self

Set the merge strategy.

Trait Implementations§

Source§

impl Default for DefaultTemplateProvider

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl TemplateProvider for DefaultTemplateProvider

Source§

fn get_person_first_name( &self, culture: NameCulture, is_male: bool, rng: &mut dyn Rng, ) -> String

Get a random person first name for the given culture and gender.
Source§

fn get_person_last_name( &self, culture: NameCulture, rng: &mut dyn Rng, ) -> String

Get a random person last name for the given culture.
Source§

fn get_vendor_name(&self, category: &str, rng: &mut dyn Rng) -> String

Get a random vendor name for the given category.
Source§

fn get_customer_name(&self, industry: &str, rng: &mut dyn Rng) -> String

Get a random customer name for the given industry.
Source§

fn get_material_description( &self, material_type: &str, rng: &mut dyn Rng, ) -> String

Get a random material description for the given type.
Source§

fn get_asset_description(&self, category: &str, rng: &mut dyn Rng) -> String

Get a random asset description for the given category.
Source§

fn get_line_text( &self, process: BusinessProcess, account_type: &str, rng: &mut dyn Rng, ) -> String

Get a random line text for the given process and account type.
Source§

fn get_header_template( &self, process: BusinessProcess, rng: &mut dyn Rng, ) -> String

Get a random header text template for the given process.
Source§

fn get_bank_name(&self, rng: &mut dyn Rng) -> Option<String>

Get a random bank name from the flat pool. (v3.2.0+) Read more
Source§

fn get_finding_title( &self, finding_type_key: &str, rng: &mut dyn Rng, ) -> Option<(String, String)>

Get a (title, account) pair for an audit finding of the given type. (v3.2.0+) Read more
Source§

fn get_finding_narrative( &self, finding_type_key: &str, section: &str, rng: &mut dyn Rng, ) -> Option<String>

Get a narrative template string for an audit finding section. (v3.2.0+) Read more
Source§

fn get_department_name( &self, department_code: &str, _rng: &mut dyn Rng, ) -> Option<String>

Get a display name for a department by code. (v3.2.0+) Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

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

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more