Skip to main content

CaptureCause

Enum CaptureCause 

Source
pub enum CaptureCause {
Show 24 variants HelperDoubled, BodyAbsent, ClauseUnread, ClauseUndeclared, ClauseDoubled, ClauseAbsent, ReferenceUnread, RosterUnread, GroupUnread, RowUnread, MappingUnread, PermissionUnread, PathUnread, ItemUnread, OrderUnpressable, ChoiceUnread, ChoiceDoubled, NameUnshadowed, NothingChosen, PhraseUnread, EndpointUnknown, NumberBeyondSeat, NameReserved, SeparatorDangling,
}
Expand description

How one helper body’s tokens do not say a declaration its grammar admits.

Dependent checks in a declared order, so exactly one cause is true of any refused body: the attribute is found before its body is read, the body’s clauses before their values, and a value’s shape before the vocabulary that value states.

Variants§

§

HelperDoubled

The declaration carries the helper more than once.

§

BodyAbsent

The helper states no parenthesized body.

§

ClauseUnread

A clause is not one key and one value.

§

ClauseUndeclared

A clause’s key is not one this grammar declares.

§

ClauseDoubled

One clause is stated twice.

§

ClauseAbsent

A required clause is absent.

§

ReferenceUnread

A value written where a namespaced reference is required is not one.

§

RosterUnread

A value written where a bracketed roster is required is not one.

§

GroupUnread

A value written where a named group is required is not one.

§

RowUnread

A row is not one name and one clause body.

§

MappingUnread

A mapping is not one fact and one claim.

§

PermissionUnread

A permission is not one claim and one family roster.

§

PathUnread

A value written where a declared Rust item path is required is not one.

§

ItemUnread

The item the helper sits on does not state a declared order this grammar can read.

§

OrderUnpressable

The declared order carries fewer than two members, so no transposition of it exists.

§

ChoiceUnread

A choice is not one bare name.

§

ChoiceDoubled

One name is chosen twice.

§

NameUnshadowed

A chosen name is not one the shadow roster covers.

§

NothingChosen

The declaration chooses no name at all.

§

PhraseUnread

A fault phrase is not one this grammar reads.

§

EndpointUnknown

A phrase or a link names a node or link the declaration never declared.

§

NumberBeyondSeat

An authored number outruns the width of the seat it is written for.

Every numeric seat has the width its harness value declares, and the capture parses at exactly that width — because generated code cannot outsource range safety to rustc: the overflowing-literal diagnostic is suppressed inside a foreign macro expansion, and an out-of-range literal wraps silently where source-authored Rust would refuse.

§

NameReserved

A declared name is one the language or the generated module already owns.

A Rust keyword, or a name the rendering itself writes beside the authored ones — either would collide in the adopter’s build, inside an expansion whose lints rustc has silenced, so the name refuses here at its own token instead.

§

SeparatorDangling

A separator stands where no clause does.

A leading or doubled comma is a phrase the author wrote, and a reader that dropped the empty group it makes would read straight past it — so the dangling separator refuses at its own token. A trailing comma after the last clause is ordinary Rust and stays lawful.

Implementations§

Source§

impl CaptureCause

Source

pub const fn described(self) -> &'static str

How this cause reads for a person.

Source

pub const fn classified(self) -> Observed

How what was observed differs from the grammar that was expected.

A clause the grammar does not declare and a value whose shape it cannot read are contract disagreements: the declaration is well formed Rust and says something this grammar does not admit. A clause that is absent is a seat that was not filled, and a clause stated twice is one key answering for two values.

Source§

impl CaptureCause

Source

pub const ALL: &'static [Self]

The complete roster, in declaration order.

Source

pub const fn name(self) -> &'static str

This row’s declared name.

Trait Implementations§

Source§

impl Clone for CaptureCause

Source§

fn clone(&self) -> CaptureCause

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 Copy for CaptureCause

Source§

impl Debug for CaptureCause

Source§

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

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

impl Eq for CaptureCause

Source§

impl Hash for CaptureCause

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for CaptureCause

Source§

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

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

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.