pub struct DomainSpecGenerator { /* private fields */ }Expand description
Generator for domain model Specs
Generates struct fields and methods based on Spec relations.
§Generated Code
For type UserSpec = Spec<DomainGroup, User, [DependsOn<Order>]>:
AddField { field_name: "order_id", field_type: "OrderId" }AddMethod { method_name: "order_id", return_type: "&OrderId" }AddDerive { derives: ["Debug", "Clone"] }(if not present)
Implementations§
Source§impl DomainSpecGenerator
impl DomainSpecGenerator
pub fn new() -> Self
pub fn with_options(self, options: GeneratorOptions) -> Self
pub fn with_groups(self, groups: Vec<String>) -> Self
Trait Implementations§
Source§impl Default for DomainSpecGenerator
impl Default for DomainSpecGenerator
Source§impl SpecGenerator for DomainSpecGenerator
impl SpecGenerator for DomainSpecGenerator
Source§fn description(&self) -> &str
fn description(&self) -> &str
Description of what this generator creates
Source§fn matches(&self, spec: &SpecAliasData) -> bool
fn matches(&self, spec: &SpecAliasData) -> bool
Check if this generator applies to the given Spec
Source§fn generate(
&self,
ctx: &AnalysisContext,
spec: &SpecAliasData,
) -> Vec<MutationSpec>
fn generate( &self, ctx: &AnalysisContext, spec: &SpecAliasData, ) -> Vec<MutationSpec>
Generate MutationSpecs from a Spec definition Read more
Auto Trait Implementations§
impl Freeze for DomainSpecGenerator
impl RefUnwindSafe for DomainSpecGenerator
impl Send for DomainSpecGenerator
impl Sync for DomainSpecGenerator
impl Unpin for DomainSpecGenerator
impl UnsafeUnpin for DomainSpecGenerator
impl UnwindSafe for DomainSpecGenerator
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> 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