Skip to main content

ArrayLenReason

Enum ArrayLenReason 

Source
pub enum ArrayLenReason {
    NotLiteralOrName,
    NotAnIntegerLiteral,
    IntegerOutOfRange,
    NotABareName,
    NotAMarkedConst,
    ConstIsNotALiteral,
    ForeignSourceConst {
        const_crate: String,
        item_crate: String,
    },
}
Expand description

Why an array length was refused.

Variants§

§

NotLiteralOrName

Not a literal and not a plain name: arithmetic, a cast, a call, a block, a match, a closure — anything with structure the grammar lacks.

§

NotAnIntegerLiteral

A literal that is not a non-negative integer.

§

IntegerOutOfRange

An integer literal too large for usize.

§

NotABareName

A path with more than one segment, a qualified self, or a leading ::crate::limits::MAX, usize::MAX, <Holder>::N, ::MAX.

A length names a #[prebindgen] const, and those live in one flat, uniquely-named namespace, so the bare name is the complete address. Any longer path either restates that (crate::limits::MAX) or reaches somewhere the frontend cannot follow — a module it does not index, an associated const it never captured, a foreign crate. Neither can be reduced to a number, and guessing between them is how a length silently becomes the wrong one.

§

NotAMarkedConst

A bare name that is not a #[prebindgen] const.

The generated crate sees only what the macro exposed, so an unmarked const is not merely unqualifiable — it does not exist downstream.

§

ConstIsNotALiteral

A #[prebindgen] const whose own initializer is not an integer literal.

build.rs cannot evaluate it, and a destination language that needs the count cannot either. Hoist the arithmetic into the value the const is computed FROM, or write the number.

§

ForeignSourceConst

A #[prebindgen] const from a different source crate than the item using it.

Uniqueness holds across the marked namespace only, so a bare name in one source crate can collide with an unmarked name of its own — the frontend would silently bind to the other crate’s value. Requiring the length’s const to come from the item’s own crate makes that unrepresentable.

Fields

§const_crate: String

Crate the const was marked in.

§item_crate: String

Crate the item using it came from.

Trait Implementations§

Source§

impl Clone for ArrayLenReason

Source§

fn clone(&self) -> ArrayLenReason

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 ArrayLenReason

Source§

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

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

impl Eq for ArrayLenReason

Source§

impl PartialEq for ArrayLenReason

Source§

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.