pub struct GenerationContext {
pub variables: HashMap<String, Value>,
}Expand description
Context for data generation, holding resolved variable values.
The context is created for each generation run and contains
the resolved values of all variables defined in the configuration.
These can be referenced using {"var": "variableName"} in the schema.
Fields§
§variables: HashMap<String, Value>Map of variable names to their resolved JSON values.
Implementations§
Source§impl GenerationContext
impl GenerationContext
Sourcepub fn with_variables(variables: HashMap<String, Value>) -> Self
pub fn with_variables(variables: HashMap<String, Value>) -> Self
Creates a new context with pre-populated variables.
Sourcepub fn get_variable(&self, name: &str) -> Option<&Value>
pub fn get_variable(&self, name: &str) -> Option<&Value>
Retrieves a variable value by name.
Sourcepub fn set_variable(&mut self, name: String, value: Value)
pub fn set_variable(&mut self, name: String, value: Value)
Sets or updates a variable value.
Trait Implementations§
Source§impl Clone for GenerationContext
impl Clone for GenerationContext
Source§fn clone(&self) -> GenerationContext
fn clone(&self) -> GenerationContext
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 GenerationContext
impl Debug for GenerationContext
Auto Trait Implementations§
impl Freeze for GenerationContext
impl RefUnwindSafe for GenerationContext
impl Send for GenerationContext
impl Sync for GenerationContext
impl Unpin for GenerationContext
impl UnwindSafe for GenerationContext
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