pub trait RunState {
    type Writer: Write;

    // Required methods
    fn make_writer(
        &mut self,
        parts: &[&str],
        type_feature: Option<&str>
    ) -> Result<Self::Writer>;
    fn handle_operation_types(
        &mut self,
        operation_optional_parameters_name: Option<&str>,
        operation_result_name: Option<&str>
    ) -> Result<()>;
    fn finish(&mut self, writer: Self::Writer);
}
Expand description

Used to create an impl of std::io::Write for each type that the type’s generated code will be written to.

Required Associated Types§

source

type Writer: Write

The impl of std::io::Write for each type that the type’s generated code will be written to.

Required Methods§

source

fn make_writer( &mut self, parts: &[&str], type_feature: Option<&str> ) -> Result<Self::Writer>

Returns an impl of std::io::Write for each type that the type’s generated code will be written to.

Parameters
  • parts: A list of strings making up the components of the path of the generated type. Code generators that are emitting crates can use this parameter to make module subdirectories for each component, and to emit use statements in the final module’s mod.rs.

  • type_feature: The name of the Rust feature that should be used to cfg-gate this type as a whole, if any. Code generators that are emitting modules can use this flag to emit a #[cfg(feature = "<this value>")] on the use statement for the generated type in the module’s mod.rs.

source

fn handle_operation_types( &mut self, operation_optional_parameters_name: Option<&str>, operation_result_name: Option<&str> ) -> Result<()>

This function is invoked with the names of the optional parameters type and result type for each operation generated for a particular type.

Code generators that are emitting modules can write out use lines in the module’s mod.rs for each of these types.

source

fn finish(&mut self, writer: Self::Writer)

This function is invoked when k8s_openapi_codegen_common::run is done with the writer and completes successfully. The implementation can do any cleanup that it wants here.

Implementations on Foreign Types§

source§

impl<T> RunState for &mut Twhere T: RunState,

§

type Writer = <T as RunState>::Writer

source§

fn make_writer( &mut self, parts: &[&str], type_feature: Option<&str> ) -> Result<Self::Writer>

source§

fn handle_operation_types( &mut self, operation_optional_parameters_name: Option<&str>, operation_result_name: Option<&str> ) -> Result<()>

source§

fn finish(&mut self, writer: Self::Writer)

Implementors§