Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 79 variants UnsupportedElementType(String), InvalidShape(String), AlignmentError { expected: usize, actual: usize, }, AlignmentNotPowerOfTwo { alignment: u32, }, AlignmentBelowMinimum { alignment: u32, minimum: u32, }, InvalidDeviceTag(u8), ReservedDeviceTag(u8), DeviceTagMismatch { expected: u8, found: u8, }, EmptyBufferList, InvalidMemoryClass(u8), ReservedMemoryClass(u8), MemoryClassMismatch { expected: u8, found: u8, }, InvalidQuantization(String), QuantizationDescriptorTooShort { found: usize, needed: usize, }, InvalidQuantizationSchemeTag(u8), ReservedQuantizationSchemeTag(u8), PrivateQuantizationSchemeTag(u8), UnknownQuantizationSchemeTag(u8), UnsupportedSchemeVersion { tag: u8, version: u8, supported: u8, }, ReservedQuantizationFlagsBits { flags: u16, mask: u16, }, InvalidBlockSize { scheme_tag: u8, block_size: u32, min: u32, max: u32, }, InvalidStorageTypeForScheme { scheme_tag: u8, type_tag: u8, }, QuantizationAxisOutOfBounds { axis: u32, rank: u32, }, QuantizationShapeMismatch { axis: u32, shape_axis: u64, block_size: u32, reason: &'static str, }, ZeroPointOutOfRange { type_tag: u8, zero_point: i32, min: i64, max: i64, }, QuantizationBufferAliasesData { index: u32, }, QuantizationBufferIndexOutOfRange { index: u32, buffer_count: u32, }, InvalidTypeTag(u8), ReservedTypeTag(u8), UnknownTypeTag(u8), RankExceedsMaximum { rank: u32, max: u32, }, InvalidLayoutTag(u8), ReservedLayoutTag(u8), NamedLayoutTag(u8), PrivateLayoutTag(u8), UnknownLayoutTag(u8), InvalidLayout(String), IndexRankMismatch { index_rank: usize, shape_rank: usize, }, IndexOutOfRange { dim: u32, index: u64, size: u64, }, AddressOverflow, ByteAddressOverflow { buffer_size: u64, }, LayoutRequiresMultiBuffer { layout_tag: u8, }, SubpavingNestingTooDeep, DynamicDimInIndexing { dim: u32, }, IndexArithmeticOverflow, InvalidSyncMode(u8), InvalidMagic { got: [u8; 4], }, UnsupportedDescriptorVersion { major: u8, minor: u8, }, DescriptorTooShort { length: u32, }, DescriptorTruncated { offset: usize, needed: usize, available: usize, }, ReservedDescriptorFlagBitsSet { flags: u32, mask: u32, }, ReservedBytesNonZero { field: &'static str, }, EmptyBufferTable, ExtensionTypeFlagMismatch { flag_set: bool, type_tag: u8, type_tag_in_range: &'static str, }, ExtensionTypePackingInvalid { bit_width: u32, packing_factor: u8, }, ExtensionTypeFieldInvalid { reason: &'static str, }, ShardOutOfBounds { dim: usize, offset: u64, size: u64, parent: u64, }, StatisticsReservedMaskBitsSet { mask: u32, }, DescriptorLengthMismatch { declared: u32, actual: usize, }, CompositeHeadHasBuffers { count: u8, }, CompositeHeadHasByteOffset { byte_offset: u64, }, CompositeHeadHasQuantization, InvalidCompositionRule(u8), ReservedCompositionRule(u8), PrivateCompositionRule(u8), InvalidCombineOp { rule: u8, combine_op: u8, }, OpenCompositeReserved, InvalidMemberRole(u8), CompositeMemberFlagMismatch { rule: u8, has_flag: bool, }, CompositeMemberCountMismatch { declared: u32, actual: usize, }, CompositeMemberMissingShard { index: usize, }, CompositeMemberParentShapeMismatch { index: usize, }, CompositeMemberTypeMismatch { index: usize, member: u8, head: u8, }, CompositeOverlayBaseNotFirst, CompositeOverlayBaseNotSpanning, CompositeOverlayEmpty, CompositePartitionGap, CompositePartitionOverlap { a: usize, b: usize, }, LayoutIsVirtual { layout_tag: u8, },
}
Expand description

Crate-level error type for hurray-core.

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

UnsupportedElementType(String)

An element type is not supported or recognized.

§

InvalidShape(String)

A shape or stride value is invalid.

§

AlignmentError

A buffer alignment requirement was not satisfied.

This variant is preserved for callers that check alignment against an externally observed value (e.g., checking the actual base-address alignment of a pointer). For descriptor-level validation, prefer Error::AlignmentNotPowerOfTwo and Error::AlignmentBelowMinimum.

Fields

§expected: usize
§actual: usize
§

AlignmentNotPowerOfTwo

The alignment field is not a power of two.

The spec requires that alignment is always a power of two (see docs/spec/buffer-protocol.md § Alignment).

Fields

§alignment: u32
§

AlignmentBelowMinimum

The alignment field is below the minimum required for a non-empty buffer.

Non-empty buffers (those with byte_size > 0) MUST declare an alignment of at least crate::MIN_BUFFER_ALIGNMENT (64 bytes) to guarantee compatibility with all current SIMD instruction sets.

Fields

§alignment: u32
§minimum: u32
§

InvalidDeviceTag(u8)

The device tag byte 0xFF is permanently invalid.

This sentinel is reserved by the spec and MUST be rejected by all conforming readers (see docs/spec/buffer-protocol.md § Device Tags).

§

ReservedDeviceTag(u8)

The device tag falls in the range 0x04–0xEF reserved for future spec versions.

Implementations MUST NOT assign semantics to tags in this range.

§

DeviceTagMismatch

All buffers in a tensor descriptor must reside on the same device.

The expected and found fields are raw wire bytes so that the error message is independent of which device tags the current implementation recognises.

Fields

§expected: u8

The wire byte of the first buffer’s device tag.

§found: u8

The wire byte of the mismatching buffer’s device tag.

§

EmptyBufferList

Buffer list is empty; at least one buffer handle is required.

Returned by crate::validate_colocation when called with an empty slice — there is no device tag to validate against.

§

InvalidMemoryClass(u8)

The memory class byte is 0xFF, which is permanently reserved by the spec.

Readers MUST reject a buffer handle whose memory_class is 0xFF.

§

ReservedMemoryClass(u8)

The memory class byte falls in the range 0x04–0xEF reserved for future spec versions.

Readers MUST reject a buffer handle with a memory_class in this range.

§

MemoryClassMismatch

All buffers in a tensor descriptor must share the same memory class.

The expected and found fields are raw wire bytes so that the error message is independent of which memory classes the current implementation recognises.

Fields

§expected: u8

The wire byte of the first buffer’s memory class.

§found: u8

The wire byte of the mismatching buffer’s memory class.

§

InvalidQuantization(String)

A quantization descriptor is malformed.

§

QuantizationDescriptorTooShort

The quantization descriptor payload is shorter than the minimum required.

Fields

§found: usize

Number of bytes available.

§needed: usize

Number of bytes required.

§

InvalidQuantizationSchemeTag(u8)

The scheme tag 0x00 or 0xFF is permanently reserved by the spec.

A reader MUST reject any descriptor whose scheme_tag is 0x00 or 0xFF.

§

ReservedQuantizationSchemeTag(u8)

The scheme tag falls in a range reserved for future specification versions.

Ranges: 0x60–0xEF. Implementations MUST NOT assign semantics to these tags.

§

PrivateQuantizationSchemeTag(u8)

The scheme tag is in the implementation-private range 0xF0–0xFE.

Private scheme tags have unconstrained payloads beyond the 4-byte header; hurray-core cannot interpret them. Callers that need private scheme support must handle the raw bytes at a higher layer.

WHY rejected here: the payload beyond the 4-byte header is unconstrained for private tags, giving this crate nothing useful to return. Callers that need private schemes handle the raw bytes at a higher layer (design decision #1).

§

UnknownQuantizationSchemeTag(u8)

The scheme tag is in an allocated range but not assigned to any known scheme.

§

UnsupportedSchemeVersion

The scheme_version field exceeds the highest version this implementation supports.

Per the spec, a reader MUST reject a descriptor whose scheme_version exceeds the highest version defined for the given scheme_tag.

Fields

§tag: u8

The scheme tag being decoded.

§version: u8

The version found on the wire.

§supported: u8

The highest version this implementation supports for this tag.

§

ReservedQuantizationFlagsBits

Reserved flags bits are set in the quantization descriptor header.

Per the spec, a reader MUST reject a descriptor with any reserved flags bit set.

Fields

§flags: u16

The full flags value found on the wire.

§mask: u16

The bitmask of bits that must be zero.

§

InvalidBlockSize

The block_size field is out of range or not a power of two for the given scheme.

Fields

§scheme_tag: u8

The quantization scheme tag.

§block_size: u32

The block size found on the wire.

§min: u32

Minimum permitted block size for this scheme.

§max: u32

Maximum permitted block size for this scheme.

§

InvalidStorageTypeForScheme

The tensor’s storage type_tag is not valid for the given quantization scheme.

Each quantization scheme defines a fixed set of permitted storage types.

Fields

§scheme_tag: u8

The quantization scheme tag.

§type_tag: u8

The storage type tag found in the tensor descriptor.

§

QuantizationAxisOutOfBounds

The quantization axis index is out of bounds for the tensor’s rank.

Per the spec, axis MUST satisfy axis < rank.

Fields

§axis: u32

The axis value from the quantization descriptor.

§rank: u32

The rank of the tensor descriptor.

§

QuantizationShapeMismatch

The tensor shape along the quantization axis is incompatible with the block size.

For MXFP, shape[axis] must be a positive multiple of block_size. For per-block-affine and NF4, block_size must not exceed shape[axis] when shape[axis] > 0.

Fields

§axis: u32

The quantization axis.

§shape_axis: u64

The resolved size of shape[axis].

§block_size: u32

The block size from the quantization descriptor.

§reason: &'static str

A human-readable description of the constraint violated.

§

ZeroPointOutOfRange

The zero_point value is outside the representable range of the storage type.

Per the spec, zero_point MUST lie within the representable range of the storage type (e.g., [0, 255] for uint8).

Fields

§type_tag: u8

The storage type tag.

§zero_point: i32

The zero-point value that was rejected.

§min: i64

Minimum representable value for the storage type.

§max: i64

Maximum representable value for the storage type.

§

QuantizationBufferAliasesData

A quantization-parameter buffer index aliases the tensor data buffer.

Per the spec, quantization-parameter buffers MUST occupy distinct indices from the tensor data buffer.

Fields

§index: u32

The offending quantization-parameter buffer index.

§

QuantizationBufferIndexOutOfRange

A quantization-parameter buffer index is out of range.

The index must be less than buffer_count in the tensor descriptor’s buffer table.

Fields

§index: u32

The out-of-range buffer index.

§buffer_count: u32

The number of buffers in the tensor descriptor’s buffer table.

§

InvalidTypeTag(u8)

The type tag 0x00 or 0xFF is explicitly invalid per the spec.

These two sentinels are permanently reserved and MUST be rejected by all conforming readers regardless of operating mode.

§

ReservedTypeTag(u8)

The type tag falls in a range reserved for future specification versions.

Reserved ranges: 0x47 and 0x80–0xEF. Implementations MUST NOT assign semantics to these tags.

§

UnknownTypeTag(u8)

The type tag is not recognized by this implementation.

This covers the private-extension range 0xF0–0xFE and any other unassigned tag value not covered by Error::InvalidTypeTag or Error::ReservedTypeTag.

§

RankExceedsMaximum

The tensor rank exceeds the maximum of 64 defined by the spec.

Fields

§rank: u32

The rank value that was rejected.

§max: u32

The maximum permitted rank (64).

§

InvalidLayoutTag(u8)

Layout tag 0x00 or 0xFF is permanently invalid.

These sentinels are reserved by the spec and MUST be rejected by all conforming readers regardless of operating mode (see docs/spec/memory-layout.md § Layout Taxonomy).

§

ReservedLayoutTag(u8)

Layout tag is in a range reserved for future specification versions.

Reserved ranges: 0x0C–0x3F, 0x41–0x7F, 0x80–0xEF. (0x0B is the composite / virtual head (ADR-027) and 0x40 is Hilbert; both are named tags in this crate.) Implementations MUST NOT assign semantics to these tags in strict mode.

§

NamedLayoutTag(u8)

A tag with a named layout descriptor was passed to the permissive UnknownLayout constructor.

“Unknown” is what lets a permissive reader relay a tag it does not understand. Applied to a tag this implementation does understand, it becomes a bypass: Unknown has no buffer count and no shape constraints, so such a descriptor would skip every check the named variant applies and then encode to a wire tag a conforming reader parses as that named layout.

§

PrivateLayoutTag(u8)

Layout tag is in the private-extension range 0xF0–0xFE.

Private extension layouts have unconstrained payloads beyond the standard header fields; strict-mode readers reject them unless both parties have agreed on semantics out of band (see docs/spec/memory-layout.md § Extension Layouts).

§

UnknownLayoutTag(u8)

Layout tag is not recognized by this implementation.

Covers any allocated but unassigned tag not already matched by Error::InvalidLayoutTag or Error::ReservedLayoutTag.

§

InvalidLayout(String)

A layout descriptor field is invalid.

The inner message describes the specific field and the constraint violated.

§

IndexRankMismatch

The number of index components does not match the tensor rank.

Fields

§index_rank: usize
§shape_rank: usize
§

IndexOutOfRange

An index component exceeds the dimension size.

Fields

§dim: u32
§index: u64
§size: u64
§

AddressOverflow

Arithmetic overflow when computing an element or byte address.

§

ByteAddressOverflow

The computed byte address falls outside the buffer bounds.

Fields

§buffer_size: u64
§

LayoutRequiresMultiBuffer

This layout requires multi-buffer access via an inherent method, not the trait.

Fields

§layout_tag: u8
§

SubpavingNestingTooDeep

Recursive layout nesting depth exceeded the implementation limit of 8 levels.

Despite the name, this guards recursion depth for every recursive structure in the crate: crate::layout::TiledLayout’s nested layout payload, and crate::composite::CompositeTensor’s cross-descriptor nesting (a member whose own layout is itself Composite). Kept as SubpavingNestingTooDeep for wire/API stability rather than renamed as part of the subpaving removal.

§

DynamicDimInIndexing

A DYNAMIC dimension cannot be used for element addressing.

Fields

§dim: u32
§

IndexArithmeticOverflow

Arithmetic overflow in Morton or Hilbert index computation.

§

InvalidSyncMode(u8)

The sync mode byte is not a recognized value.

Valid sync mode bytes are 0x00 (ProducerSynced), 0x01 (Event), and 0x02 (ConsumerStream). Bytes 0x03–0xFF are reserved or permanently invalid; all conforming readers MUST reject them.

See docs/spec/buffer-protocol.md § Synchronization Mode and ADR-018.

§

InvalidMagic

Magic bytes are not "HRRY" (0x48 0x52 0x52 0x59).

Fields

§got: [u8; 4]

The four bytes actually found at offset 0.

§

UnsupportedDescriptorVersion

version_major exceeds the supported major version (1).

Fields

§major: u8

The major version found on the wire.

§minor: u8

The minor version found on the wire.

§

DescriptorTooShort

descriptor_length is less than the minimum valid size (20).

Fields

§length: u32

The descriptor_length value found on the wire.

§

DescriptorTruncated

Cursor ran out of bytes before a field could be read.

Fields

§offset: usize

Byte offset at which the read was attempted.

§needed: usize

Number of bytes needed.

§available: usize

Number of bytes actually available.

§

ReservedDescriptorFlagBitsSet

A reserved flag bit is set.

Fields

§flags: u32

The full flags value found on the wire.

§mask: u32

The bitmask of bits that must be zero.

§

ReservedBytesNonZero

A reserved field that MUST be 0x00 contains a non-zero byte.

Fields

§field: &'static str

Human-readable name of the reserved field.

§

EmptyBufferTable

buffer_count is 0 (minimum is 1).

§

ExtensionTypeFlagMismatch

HAS_EXTENSION_TYPE flag ↔ type_tag range disagree.

Fields

§flag_set: bool

Whether the HAS_EXTENSION_TYPE flag was set.

§type_tag: u8

The type_tag byte found on the wire.

§type_tag_in_range: &'static str

Human-readable range description.

§

ExtensionTypePackingInvalid

Extension type bit_width / packing_factor is invalid.

Fields

§bit_width: u32

The bit_width value from the extension type descriptor.

§packing_factor: u8

The packing_factor value from the extension type descriptor.

§

ExtensionTypeFieldInvalid

An extension type field carries a value the spec forbids for its family.

Fields

§reason: &'static str

Which rule was violated, in the spec’s own terms.

§

ShardOutOfBounds

shard_offset[k] + shape[k] > parent_shape[k].

Fields

§dim: usize

The dimension index where the constraint was violated.

§offset: u64

The shard_offset value for that dimension.

§size: u64

The tensor shape value for that dimension.

§parent: u64

The parent_shape value for that dimension.

§

StatisticsReservedMaskBitsSet

computed_mask has reserved bits set (bits ≥ 6).

Fields

§mask: u32

The full computed_mask value found on the wire.

§

DescriptorLengthMismatch

descriptor_length declared in the header does not match the actual encoded length.

Fields

§declared: u32

The descriptor_length value declared in the header.

§actual: usize

The actual number of bytes consumed when parsing.

§

CompositeHeadHasBuffers

A composite head (layout_tag = 0x0B) declared a non-empty buffer table.

Fields

§count: u8

The (non-zero) buffer count found on the wire.

§

CompositeHeadHasByteOffset

A composite head declared a non-zero byte_offset.

Fields

§byte_offset: u64

The offending byte_offset value.

§

CompositeHeadHasQuantization

A composite head set the HAS_QUANTIZATION flag, but a virtual head owns no stored data.

§

InvalidCompositionRule(u8)

The composition_rule byte 0xFF is permanently invalid.

§

ReservedCompositionRule(u8)

The composition_rule byte falls in the range reserved for future specification versions (0x00 and 0x04–0xEF).

§

PrivateCompositionRule(u8)

The composition_rule byte is in the implementation-private range 0xF0–0xFE.

§

InvalidCombineOp

The combine_op byte is not legal for the given composition_rule.

Fields

§rule: u8

The wire composition_rule byte.

§combine_op: u8

The offending combine_op byte.

§

OpenCompositeReserved

The member_count sentinel 0xFFFFFFFF (open composite) is RESERVED and not usable in v1.0.

§

InvalidMemberRole(u8)

The Composite Member section’s member_role byte is not 0x00 or 0x01.

§

CompositeMemberFlagMismatch

A member’s HAS_COMPOSITE_MEMBER flag disagrees with what its composition rule requires.

Overlay members MUST carry a Composite Member section; partition and group members MUST NOT.

Fields

§rule: u8

The wire composition_rule byte of the enclosing head.

§has_flag: bool

Whether the member actually carried a Composite Member section.

§

CompositeMemberCountMismatch

The number of members actually supplied does not match the head’s declared member_count.

Fields

§declared: u32

The member_count declared by the head.

§actual: usize

The number of members actually pushed to the validator.

§

CompositeMemberMissingShard

A partition or overlay member did not carry a shard section (HAS_SHARD).

Fields

§index: usize

The 0-based index of the offending member.

§

CompositeMemberParentShapeMismatch

A member’s shard parent_shape does not equal the composite head’s shape.

Fields

§index: usize

The 0-based index of the offending member.

§

CompositeMemberTypeMismatch

A member’s decoded value type does not equal the composite head’s type_tag.

Fields

§index: usize

The 0-based index of the offending member.

§member: u8

The member’s own type_tag byte.

§head: u8

The head’s type_tag byte.

§

CompositeOverlayBaseNotFirst

An overlay composite’s first member is not the base, or a base member appeared at a position other than first.

§

CompositeOverlayBaseNotSpanning

An overlay composite’s base member does not span the whole index space.

§

CompositeOverlayEmpty

An overlay composite head declared member_count = 0 (no base member available).

§

CompositePartitionGap

A partition composite’s members leave a gap in the head’s index space.

§

CompositePartitionOverlap

Two partition members’ boxes overlap.

Fields

§a: usize

The 0-based index of the first overlapping member.

§b: usize

The 0-based index of the second overlapping member.

§

LayoutIsVirtual

A layout is virtual (owns no data buffer) and does not support element addressing.

Currently only the composite head (layout_tag = 0x0B) is virtual; addressing a composite requires resolving to a member first (see hurray_core::composite).

Fields

§layout_tag: u8

The virtual layout’s wire tag.

Trait Implementations§

Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Error for Error

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl UnwindSafe for Error

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.