Enum pact_models::generators::Generator[][src]

pub enum Generator {
Show 13 variants RandomInt(i32i32), Uuid(Option<UuidFormat>), RandomDecimal(u16), RandomHexadecimal(u16), RandomString(u16), Regex(String), Date(Option<String>), Time(Option<String>), DateTime(Option<String>), RandomBoolean, ProviderStateGenerator(StringOption<DataType>), MockServerURL(StringString), ArrayContains(Vec<(usize, MatchingRuleCategory, HashMap<DocPath, Generator>)>),
}
Expand description

Trait to represent a generator

Variants

RandomInt(i32i32)

Tuple Fields

0: i32
1: i32

Generates a random integer between the min and max values

Uuid(Option<UuidFormat>)

Tuple Fields

Generates a random UUID value

RandomDecimal(u16)

Tuple Fields

0: u16

Generates a random sequence of digits

RandomHexadecimal(u16)

Tuple Fields

0: u16

Generates a random sequence of hexadecimal digits

RandomString(u16)

Tuple Fields

0: u16

Generates a random string of the provided size

Regex(String)

Tuple Fields

0: String

Generates a random string that matches the provided regex

Date(Option<String>)

Tuple Fields

Generates a random date that matches either the provided format or the ISO format

Time(Option<String>)

Tuple Fields

Generates a random time that matches either the provided format or the ISO format

DateTime(Option<String>)

Tuple Fields

Generates a random timestamp that matches either the provided format or the ISO format

RandomBoolean

Generates a random boolean value

ProviderStateGenerator(StringOption<DataType>)

Tuple Fields

0: String

Generates a value that is looked up from the provider state context

MockServerURL(StringString)

Tuple Fields

0: String
1: String

Generates a URL with the mock server as the base URL

ArrayContains(Vec<(usize, MatchingRuleCategory, HashMap<DocPath, Generator>)>)

List of variants which can have embedded generators

Implementations

Convert this generator to a JSON struct

Converts a JSON map into a Generator struct, returning None if it can not be converted.

If this generator is compatible with the given generator mode

Returns the type name of this generator

Returns the values for this generator

Create a generator from a type and a map of attributes

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Generates a new value based on the source value. An error will be returned if the value can not be generated. Read more

Generates a new value based on the source value. An error will be returned if the value can not be generated. Read more

Generates a new value based on the source value. An error will be returned if the value can not be generated. Read more

Generates a new value based on the source value. An error will be returned if the value can not be generated. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Performs the conversion.

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

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

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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

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