k8s_openapi_codegen_common

Trait RunState

Source
pub trait RunState {
    type Writer: Write;

    // Required methods
    fn make_writer(&mut self, parts: &[&str]) -> Result<Self::Writer>;
    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]) -> 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.
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 T
where T: RunState,

Source§

type Writer = <T as RunState>::Writer

Source§

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

Source§

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

Implementors§