pub struct SampleGenerator { /* private fields */ }
Expand description
A builder for generating SWIFT MT message samples with custom configuration
The SampleGenerator
provides a fluent interface for configuring and generating
SWIFT MT message samples with custom scenario paths.
§Example
let generator = SampleGenerator::new()
.with_path(PathBuf::from("./custom_scenarios"))
.with_path(PathBuf::from("./backup_scenarios"));
let mt103: SwiftMessage<MT103> = generator.generate("MT103", None).unwrap();
let mt103_stp: SwiftMessage<MT103> = generator.generate("MT103", Some("stp")).unwrap();
Implementations§
Source§impl SampleGenerator
impl SampleGenerator
Sourcepub fn with_config(config: ScenarioConfig) -> Self
pub fn with_config(config: ScenarioConfig) -> Self
Create a sample generator with specific configuration
Sourcepub fn with_paths(self, paths: Vec<PathBuf>) -> Self
pub fn with_paths(self, paths: Vec<PathBuf>) -> Self
Set multiple paths to search for scenario files (replaces existing paths)
Sourcepub fn generate<T>(
&self,
message_type: &str,
scenario_name: Option<&str>,
) -> Result<SwiftMessage<T>>where
T: SwiftMessageBody + DeserializeOwned,
pub fn generate<T>(
&self,
message_type: &str,
scenario_name: Option<&str>,
) -> Result<SwiftMessage<T>>where
T: SwiftMessageBody + DeserializeOwned,
Generate a sample SWIFT MT message
§Arguments
message_type
- The MT message type (e.g., “MT103”, “MT202”)scenario_name
- Optional scenario name. If None, uses the default scenario
Sourcepub fn config(&self) -> &ScenarioConfig
pub fn config(&self) -> &ScenarioConfig
Get a reference to the current configuration
Trait Implementations§
Source§impl Clone for SampleGenerator
impl Clone for SampleGenerator
Source§fn clone(&self) -> SampleGenerator
fn clone(&self) -> SampleGenerator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for SampleGenerator
impl Debug for SampleGenerator
Auto Trait Implementations§
impl Freeze for SampleGenerator
impl RefUnwindSafe for SampleGenerator
impl Send for SampleGenerator
impl Sync for SampleGenerator
impl Unpin for SampleGenerator
impl UnwindSafe for SampleGenerator
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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