Skip to main content

Line

Enum Line 

Source
pub enum Line {
    Usable(Declared),
    Broken {
        name: String,
        stage: Stage,
        lineno: usize,
        why: ParseError,
    },
}
Expand description

One manifest line: usable, or not.

A SUM, not a struct with an Option<why> beside the fields. The struct form let a broken line carry a severity, a scope and an argv that meant nothing — and it produced a wrong diagnosis: because broken and usable entries shared one list, a valid line was rejected as “declared twice” for colliding with a line that could not run. Dedup now sees only Usable.

Separate from External because the fleet reads ninety-six manifests and may re-read them on every refresh, while External holds a Scope whose &'static slices are LEAKED.

Variants§

§

Usable(Declared)

§

Broken

Fields

§name: String

The declared name, or <file>:<lineno> when the line has none — a gap has to be nameable to be reportable.

§stage: Stage

Broken lines land on pre-commit unless the stage token parsed: seen on every commit beats seen on every push.

§lineno: usize

Implementations§

Source§

impl Line

Source

pub fn name(&self) -> &str

Source

pub fn stage(&self) -> Stage

Source

pub fn broken(&self) -> Option<String>

Some(reason) when this line declares a check that cannot run.

Source

pub fn id(&self) -> String

<trigger>-<name>, matching Declared::id and External::id. A broken line has one too: hook.skip pre-commit should silence its nag exactly as it silences the checks that do run.

Source

pub fn into_parts(self) -> (String, Stage, Result<Declared, String>)

Consume into the identity every line has, and either the declaration or the reason there is none.

Both consumers — External::from and the fleet’s projection — used to destructure this by hand, and both carried an arm for a combination the type forbids, because they computed the reason BEFORE matching. Written once, that arm has nowhere to appear.

Trait Implementations§

Source§

impl Clone for Line

Source§

fn clone(&self) -> Line

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 Line

Source§

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

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

impl Eq for Line

Source§

impl From<Line> for External

Source§

fn from(l: Line) -> External

Converts to this type from the input type.
Source§

impl PartialEq for Line

Source§

fn eq(&self, other: &Line) -> 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 Line

Auto Trait Implementations§

§

impl Freeze for Line

§

impl RefUnwindSafe for Line

§

impl Send for Line

§

impl Sync for Line

§

impl Unpin for Line

§

impl UnsafeUnpin for Line

§

impl UnwindSafe for Line

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

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.