[][src]Struct schemafy_snapshot::GenerateBuilder

pub struct GenerateBuilder<'a> {
    pub root_name: Option<&'a str>,
    pub schemafy_path: &'a str,
    pub rustfmt_cmd: Option<Command>,
}

A configurable builder for generating Rust types from a JSON schema.

The default options are usually fine. In that case, you can use the generate() convenience method instead.

Fields

root_name: Option<&'a str>

The name of the root type defined by the schema. If the schema does not define a root type (some schemas are simply a collection of definitions) then simply pass None.

schemafy_path: &'a str

The module path to this crate. Some generated code may make use of types defined in this crate. Unless you have re-exported this crate or imported it under a different name, the default should be fine.

rustfmt_cmd: Option<Command>

A command to format the generated Rust code. The command should read from stdin and write to stdout.

Methods

impl<'a> GenerateBuilder<'a>[src]

pub fn build(self, s: &str) -> Result<String, Box<dyn Error>>[src]

Generate Rust types.

Trait Implementations

impl<'a> Default for GenerateBuilder<'a>[src]

Auto Trait Implementations

impl<'a> Send for GenerateBuilder<'a>

impl<'a> !Sync for GenerateBuilder<'a>

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]