[][src]Struct pact_matching::models::generators::Generators

pub struct Generators {
    pub categories: HashMap<GeneratorCategory, HashMap<String, Generator>>,
}

Data structure for representing a collection of generators

Fields

categories: HashMap<GeneratorCategory, HashMap<String, Generator>>

Map of generator categories to maps of generators

Implementations

impl Generators[src]

pub fn is_empty(&self) -> bool[src]

If the generators are empty (that is there are no rules assigned to any categories)

pub fn is_not_empty(&self) -> bool[src]

If the generators are not empty (that is there is at least one rule assigned to a category)

pub fn load_from_map(&mut self, map: &Map<String, Value>)[src]

Loads the generators for a JSON map

pub fn add_generator(
    &mut self,
    category: &GeneratorCategory,
    generator: Generator
)
[src]

Adds the generator to the category (body, headers, etc.)

pub fn add_generator_with_subcategory<S: Into<String>>(
    &mut self,
    category: &GeneratorCategory,
    subcategory: S,
    generator: Generator
)
[src]

Adds a generator to the category with a sub-category key (i.e. headers or query parameters)

pub fn apply_generator<F>(
    &self,
    mode: &GeneratorTestMode,
    category: &GeneratorCategory,
    closure: F
) where
    F: FnMut(&String, &Generator), 
[src]

If there are generators for the provided category, invokes the closure for all keys and values in the category.

pub fn apply_body_generators(
    &self,
    mode: &GeneratorTestMode,
    body: &OptionalBody,
    content_type: Option<ContentType>,
    context: &HashMap<&str, Value>
) -> OptionalBody
[src]

Applies all the body generators to the body and returns a new body (if anything was applied).

Trait Implementations

impl Clone for Generators[src]

impl Debug for Generators[src]

impl Default for Generators[src]

impl<'de> Deserialize<'de> for Generators[src]

impl Eq for Generators[src]

impl Hash for Generators[src]

impl PartialEq<Generators> for Generators[src]

impl Serialize for Generators[src]

impl StructuralEq for Generators[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Typeable for T where
    T: Any

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