Skip to main content

ValidationOutcome

Enum ValidationOutcome 

Source
pub enum ValidationOutcome {
    Unsupported,
    Passed {
        tools_run: Vec<&'static str>,
        tools_missing: Vec<&'static str>,
    },
    Failed {
        tools_run: Vec<&'static str>,
        tools_missing: Vec<&'static str>,
        errors: Vec<String>,
    },
}
Expand description

A validation result for one backend’s generated output, shaped for a caller (the CLI, in particular) to report directly to a user rather than for a test assertion to pick apart.

Three variants, not two, on purpose: collapsing Self::Unsupported into Self::Passed is the exact dishonesty ToolValidation exists to prevent – see that type’s doc comment. A caller that only distinguished pass from fail would report “OK” for a csharp-npgsql file that no compiler ever looked at, which is the bug this whole module was written to close.

Variants§

§

Unsupported

No tool-based validator exists for this backend’s language at all (see ToolValidation::Unsupported). Not a pass and not a failure – report it as “not checked”, never as “checked, no problems”.

§

Passed

A validator exists and every checker that ran found nothing wrong.

tools_run names the checkers that actually inspected the code; tools_missing names any this validator would also have liked to run but could not find on PATH. Both are carried through rather than collapsed, because “passed, nothing was installed to check it” (tools_run empty) and “passed, poly verified it” are different claims a caller may want to report differently even though neither is a build failure under the default, non-strict policy this is built on (see ToolValidation::into_result_with_strictness).

Fields

§tools_run: Vec<&'static str>

Checkers that ran to completion and found nothing wrong.

§tools_missing: Vec<&'static str>

Checkers this validator wanted to run but could not find.

§

Failed

A checker found a problem with the generated code, or the harness itself could not drive an installed tool. Never produced by a merely-missing tool – see ToolOutcome::Missing vs. ToolOutcome::Failed, which is exactly the distinction that keeps an uninstalled linter from reading as a build failure here.

Fields

§tools_run: Vec<&'static str>

Checkers that ran to completion (regardless of whether they were the one that reported a problem).

§tools_missing: Vec<&'static str>

Checkers this validator wanted to run but could not find.

§errors: Vec<String>

Findings, already prefixed with the tool name that reported each one – see ToolValidation::errors.

Implementations§

Source§

impl ValidationOutcome

Source

pub fn is_failure(&self) -> bool

Whether this outcome should stop a build: true only for Self::Failed.

Both Self::Unsupported and Self::Passed are “let it through” outcomes under the default policy – a caller that wants “no validator for this language” to also block a build (unusual: it would stop every C#, Rust, kotlin-exposed, and kotlin-r2dbc backend from ever generating) must match on the variant itself rather than use this helper.

Trait Implementations§

Source§

impl Clone for ValidationOutcome

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ValidationOutcome

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for ValidationOutcome

Source§

impl PartialEq for ValidationOutcome

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ValidationOutcome

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.