#[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
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).
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.