pub struct Generator { /* private fields */ }Expand description
Main generator that coordinates all the pieces.
Implementations§
Source§impl Generator
impl Generator
Sourcepub fn builder(spec: OpenAPI) -> GeneratorBuilder
pub fn builder(spec: OpenAPI) -> GeneratorBuilder
Create a builder from an OpenAPI spec.
Sourcepub fn builder_from_file(path: &Path) -> Result<GeneratorBuilder>
pub fn builder_from_file(path: &Path) -> Result<GeneratorBuilder>
Create a builder by loading an OpenAPI spec from a file.
Sourcepub fn new(spec: OpenAPI) -> Result<Self>
pub fn new(spec: OpenAPI) -> Result<Self>
Create a new generator from an OpenAPI spec with default settings.
Sourcepub fn with_settings(spec: OpenAPI, settings: TypeSpaceSettings) -> Result<Self>
pub fn with_settings(spec: OpenAPI, settings: TypeSpaceSettings) -> Result<Self>
Create a new generator from an OpenAPI spec with custom type settings.
Sourcepub fn spec(&self) -> &ParsedSpec
pub fn spec(&self) -> &ParsedSpec
Get the parsed spec.
Sourcepub fn type_generator(&self) -> &TypeGenerator
pub fn type_generator(&self) -> &TypeGenerator
Get the type generator.
Sourcepub fn generate_types(&self) -> TokenStream
pub fn generate_types(&self) -> TokenStream
Generate all types as a TokenStream.
Sourcepub fn generate_responses(&self) -> TokenStream
pub fn generate_responses(&self) -> TokenStream
Generate response enums for all operations.
Sourcepub fn generate_query_structs(&self) -> TokenStream
pub fn generate_query_structs(&self) -> TokenStream
Generate query parameter structs for all operations.
Sourcepub fn generate_path_structs(&self) -> TokenStream
pub fn generate_path_structs(&self) -> TokenStream
Generate path parameter structs for all operations.
Sourcepub fn type_overrides(&self) -> &TypeOverrides
pub fn type_overrides(&self) -> &TypeOverrides
Get the type overrides.
Sourcepub fn response_suffixes(&self) -> &ResponseSuffixes
pub fn response_suffixes(&self) -> &ResponseSuffixes
Get the response suffixes.
Sourcepub fn get_operation(
&self,
method: HttpMethod,
path: &str,
) -> Option<&Operation>
pub fn get_operation( &self, method: HttpMethod, path: &str, ) -> Option<&Operation>
Look up an operation by HTTP method and path.
Sourcepub fn operations(&self) -> impl Iterator<Item = &Operation>
pub fn operations(&self) -> impl Iterator<Item = &Operation>
Get all operations.
Sourcepub fn validate_coverage(
&self,
covered: &HashSet<(HttpMethod, String)>,
) -> Result<()>
pub fn validate_coverage( &self, covered: &HashSet<(HttpMethod, String)>, ) -> Result<()>
Validate that all operations are covered by trait methods.
Auto Trait Implementations§
impl Freeze for Generator
impl RefUnwindSafe for Generator
impl !Send for Generator
impl !Sync for Generator
impl Unpin for Generator
impl UnwindSafe for Generator
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