Struct preserves_schema::compiler::CompilerConfig

source ·
pub struct CompilerConfig {
    pub bundle: Map<ModulePath, (Schema, Purpose)>,
    pub fully_qualified_module_prefix: String,
    pub support_crate: String,
    pub external_modules: Map<ModulePath, ExternalModule>,
    pub plugins: Vec<Box<dyn Plugin>>,
    pub rustfmt_skip: bool,
}
Expand description

Main entry point to the compiler.

Fields§

§bundle: Map<ModulePath, (Schema, Purpose)>

All known Schema modules, indexed by ModulePath and annotated with a Purpose.

§fully_qualified_module_prefix: String

Fully-qualified Rust module prefix to use for each generated module.

§support_crate: String

Rust module path to the preserves_schema::support module.

§external_modules: Map<ModulePath, ExternalModule>

External modules for cross-referencing.

§plugins: Vec<Box<dyn Plugin>>

Plugins active in this compiler instance.

§rustfmt_skip: bool

If true, a directive is emitted in each module instructing rustfmt to ignore it.

Implementations§

source§

impl CompilerConfig

source

pub fn new(fully_qualified_module_prefix: String) -> Self

Construct a CompilerConfig configured to use fully_qualified_module_prefix as the Rust module prefix for generated code.

source

pub fn add_external_module(&mut self, m: ExternalModule)

source

pub fn load_schemas_and_bundles( &mut self, inputs: &Vec<PathBuf>, xrefs: &Vec<PathBuf> ) -> Result<()>

source

pub fn load_xref_bin( &mut self, prefix: &str, bundle_or_schema: &[u8] ) -> Result<()>

Trait Implementations§

source§

impl Debug for CompilerConfig

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<L, N> Codec<N> for L
where N: NestedValue,

source§

fn parse<'a, T>(&'a self, value: &N) -> Result<T, ParseError>
where T: Parse<&'a L, N>,

Delegates to T::parse, using self as language and the given value as input.
source§

fn unparse<'a, T>(&'a self, value: &T) -> N
where T: Unparse<&'a L, N>,

Delegates to value.unparse, using self as language.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where 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 T
where 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 T
where 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.