Skip to main content

CompileCx

Struct CompileCx 

Source
pub struct CompileCx<'a> { /* private fields */ }
Expand description

Compiles config fields, recording each issue at its exact authored path.

Implementations§

Source§

impl<'a> CompileCx<'a>

Source

pub fn new(exprs: &'a ExprEngine, issues: &'a mut Vec<Issue>) -> Self

A context rooted at the document itself.

Source

pub fn at_path(self, path: AuthoredPath) -> Self

Roots the walk at path; a field is the first key below it.

Source

pub fn for_step(self, kind: StepKind, id: impl Into<String>) -> Self

Stamps the step on every issue.

Source

pub fn with_runtime_fields(self, fields: &'a [FieldSpec]) -> Self

The fields a plugin declared at runtime.

Source

pub fn exprs(&self) -> &ExprEngine

The engine expressions compile with.

Source

pub fn path(&self) -> &AuthoredPath

The current path.

Source

pub fn runtime_fields(&self) -> Option<&'a [FieldSpec]>

The runtime-declared fields, if any.

Source

pub fn issue(&mut self, code: IssueCode, message: impl Into<String>)

Records an issue at the current path, at the code’s default severity.

Source

pub fn issue_as( &mut self, code: IssueCode, severity: Severity, message: impl Into<String>, )

Records an issue at the current path with an explicit severity.

Source

pub fn at<R>( &mut self, seg: impl Into<PathSeg>, f: impl FnOnce(&mut Self) -> R, ) -> R

Runs f one segment deeper.

Source

pub fn rejected(&self) -> usize

How many Rejected issues this context has recorded.

Trait Implementations§

Source§

impl Debug for CompileCx<'_>

Source§

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

The current path, the step, and how many issues are recorded and Rejected; not the issues or the engine.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for CompileCx<'a>

§

impl<'a> !UnwindSafe for CompileCx<'a>

§

impl<'a> Freeze for CompileCx<'a>

§

impl<'a> Send for CompileCx<'a>

§

impl<'a> Sync for CompileCx<'a>

§

impl<'a> Unpin for CompileCx<'a>

§

impl<'a> UnsafeUnpin for CompileCx<'a>

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<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>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.