Struct pact_models::generators::Generators
source · pub struct Generators {
pub categories: HashMap<GeneratorCategory, HashMap<DocPath, Generator>>,
}
Expand description
Data structure for representing a collection of generators
Fields§
§categories: HashMap<GeneratorCategory, HashMap<DocPath, Generator>>
Map of generator categories to maps of generators
Implementations§
source§impl Generators
impl Generators
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
If the generators are empty (that is there are no rules assigned to any categories)
sourcepub fn is_not_empty(&self) -> bool
pub fn is_not_empty(&self) -> bool
If the generators are not empty (that is there is at least one rule assigned to a category)
sourcepub fn load_from_map(&mut self, map: &Map<String, Value>) -> Result<()>
pub fn load_from_map(&mut self, map: &Map<String, Value>) -> Result<()>
Loads the generators for a JSON map
sourcepub fn add_generator(
&mut self,
category: &GeneratorCategory,
generator: Generator
)
pub fn add_generator( &mut self, category: &GeneratorCategory, generator: Generator )
Adds the generator to the category (body, headers, etc.)
sourcepub fn add_generator_with_subcategory(
&mut self,
category: &GeneratorCategory,
subcategory: DocPath,
generator: Generator
)
pub fn add_generator_with_subcategory( &mut self, category: &GeneratorCategory, subcategory: DocPath, generator: Generator )
Adds a generator to the category with a sub-category key (i.e. headers or query parameters)
sourcepub fn add_generators(&mut self, generators: Generators)
pub fn add_generators(&mut self, generators: Generators)
Add all the generators
Trait Implementations§
source§impl Clone for Generators
impl Clone for Generators
source§fn clone(&self) -> Generators
fn clone(&self) -> Generators
Returns a copy 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 Generators
impl Debug for Generators
source§impl Default for Generators
impl Default for Generators
source§impl Hash for Generators
impl Hash for Generators
source§impl PartialEq for Generators
impl PartialEq for Generators
impl Eq for Generators
Auto Trait Implementations§
impl Freeze for Generators
impl RefUnwindSafe for Generators
impl Send for Generators
impl Sync for Generators
impl Unpin for Generators
impl UnwindSafe for Generators
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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