Struct conjure_codegen::Config

source ·
pub struct Config { /* private fields */ }
Expand description

Codegen configuration.

Implementations§

source§

impl Config

source

pub fn new() -> Config

Creates a new Config with default settings.

source

pub fn exhaustive(&mut self, exhaustive: bool) -> &mut Config

Controls exhaustive matchability of unions and enums.

Non-exhaustive unions and enums have the ability to deserialize and reserialize unknown variants. This enables clients to be more forward-compatible with changes made by newer servers.

Defaults to false.

source

pub fn staged_builders(&mut self, staged_builders: bool) -> &mut Config

If enabled, generated objects will use “staged builders”.

Staged builders guarantee that all fields are set at compile time rather than panicing during construction.

Defaults to false.

source

pub fn run_rustfmt(&mut self, _run_rustfmt: bool) -> &mut Config

👎Deprecated since 1.2.0: no longer used

No longer used.

source

pub fn rustfmt<T>(&mut self, _rustfmt: T) -> &mut Configwhere T: AsRef<OsStr>,

👎Deprecated since 1.2.0: no longer used

No longer used.

source

pub fn strip_prefix<T>(&mut self, strip_prefix: T) -> &mut Configwhere T: Into<Option<String>>,

Sets a prefix that will be stripped from package names.

Defaults to None.

source

pub fn version<T>(&mut self, version: T) -> &mut Configwhere T: Into<Option<String>>,

Sets the version included in endpoint metadata for generated client bindings.

Defaults to the version passed to Self::build_crate, or None otherwise.

source

pub fn build_crate(&mut self, name: &str, version: &str) -> &mut Config

Switches generation to create a full crate.

Defaults to just generating a single module.

source

pub fn generate_files<P, Q>(&self, ir_file: P, out_dir: Q) -> Result<(), Error>where P: AsRef<Path>, Q: AsRef<Path>,

Generates Rust source files from a JSON-encoded Conjure IR file.

Trait Implementations§

source§

impl Default for Config

source§

fn default() -> Config

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.