Skip to main content

Rule

Enum Rule 

Source
#[non_exhaustive]
pub enum Rule {
Show 26 variants FileTooSmall, HeaderMagic, FooterMagic, Version, ManifestBounds, ManifestTooLarge, ManifestHash, CborSyntax, CborDeterminism, CborDuplicateKey, CborDepth, Schema, Name, Shape, BlobAlignment, BlobBounds, BlobOverlap, ShardRef, ShardName, LayoutRule, LayoutData, DenseSize, Encoding, Digest, ShardIdentity, NameCollision,
}
Expand description

The spec rule a rejected file violated.

Tags correspond to sections of spec/ztensor-v2-spec.md so the conformance corpus can assert exact rejection reasons. The set grows with the spec, so it is #[non_exhaustive]: matching on one rule stays source-compatible when the next is added.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

FileTooSmall

Shorter than a header plus a footer, so there is no container (§2.1).

§

HeaderMagic

The first eight bytes are not the magic (§2.2).

§

FooterMagic

The last eight bytes are not the magic (§2.2).

§

Version

The footer’s version integer is one this build does not implement.

§

ManifestBounds

The manifest blob falls outside the data region, or a data shard’s footer does not zero the manifest fields (§2.3, §7.2).

§

ManifestTooLarge

The declared manifest length exceeds the 1 GiB cap (§3.1).

§

ManifestHash

The manifest bytes do not hash to what the footer claims (§2.3).

§

CborSyntax

The manifest is not well-formed CBOR.

§

CborDeterminism

Well-formed CBOR, but not the deterministic encoding the format requires: a non-shortest head, an indefinite length, or unsorted map keys (§3.1).

§

CborDuplicateKey

A CBOR map repeats a key (§3.1).

§

CborDepth

CBOR nesting beyond the depth limit, the bound that keeps a hostile manifest from exhausting the stack.

§

Schema

The manifest parses but is not the shape the schema describes: a missing field, a field of the wrong type, a value out of range (§3).

§

Name

An object, part, or attribute name violates §3.5.

§

Shape

A shape exceeds the rank limit, or its element product overflows u64 (§3.3).

§

BlobAlignment

A blob offset is not on the alignment floor (§2.4).

§

BlobBounds

A blob runs past the end of the file’s data region (§2.4).

§

BlobOverlap

Two blobs in one file overlap partially. Sharing is identical-or -disjoint, never in between (§2.4).

§

ShardRef

A part names a shard the manifest’s table does not declare (§7.1).

§

ShardName

A shard name is outside the character set of §7.1.

§

LayoutRule

Object metadata violates its layout profile’s rules (§5.2).

§

LayoutData

Data-level violation of a layout profile (e.g., CSR indptr rules).

§

DenseSize

A dense part’s decoded size is not product(shape) × width(dtype) (§5.1).

§

Encoding

Stored bytes violate their declared encoding profile.

§

Digest

A digest is malformed, or the bytes do not hash to it (§3.4).

§

ShardIdentity

A resolved shard does not match the identity in the root’s table (§7.1, §7.3).

§

NameCollision

Two sources of one composite claim the same tensor name.

Trait Implementations§

Source§

impl Clone for Rule

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

Source§

impl Debug for Rule

Source§

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

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

impl Eq for Rule

Source§

impl PartialEq for Rule

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 Rule

Auto Trait Implementations§

§

impl Freeze for Rule

§

impl RefUnwindSafe for Rule

§

impl Send for Rule

§

impl Sync for Rule

§

impl Unpin for Rule

§

impl UnsafeUnpin for Rule

§

impl UnwindSafe for Rule

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