Skip to main content

ErrorCode

Enum ErrorCode 

Source
#[non_exhaustive]
pub enum ErrorCode {
Show 28 variants Io, Sqlite, NotAFile, TooLarge, FileLength, Schema, Identity, FreePages, Meta, Profile, String, StringIds, Plane, Zone, Anchor, Stairwell, StairwellStep, Definition, Chunk, ChunkEncoding, ChunkData, ChunkRecord, Reference, ObjectUid, Integrity, Digest, DecodeBudget, Invalid,
}
Expand description

Stable codes for why a pack failed to open, read or verify, one per rule of docs/spec/PACK.md section 3. The Go reader reports the same codes, and the conformance fixtures in fixtures/packs pin them.

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

Io

The file could not be read.

§

Sqlite

SQLite failed, for example on a file that is not a database.

§

NotAFile

The path is not a regular file.

§

TooLarge

The file is longer than the pack size limit.

§

FileLength

The file is not exactly its pages.

§

Schema

The schema is not exactly the format’s.

§

Identity

The application ID, user version or page size is not the format’s, or the SQLite header’s file format versions are not 1.

§

FreePages

The pack has free pages.

§

Meta

meta does not hold exactly the format’s keys and values.

§

Profile

The stored profile is invalid or disagrees with meta.

§

String

A string is not UTF-8 text of at most 1 MiB without NUL.

§

StringIds

String IDs are not 1..=count in byte order of their values.

§

Plane

A plane row or document is invalid.

§

Zone

A zone row or document is invalid, or zone parents form a cycle.

§

Anchor

An anchor row is invalid.

§

Stairwell

A stairwell row or document is invalid or disagrees with its steps.

§

StairwellStep

A stairwell_steps row is invalid or listed by no stairwell.

§

Definition

A definition row or document is invalid.

§

Chunk

A chunk row’s key is invalid, or its record disagrees with its plane or the profile.

§

ChunkEncoding

A chunk’s encoding is not twc1+zstd.

§

ChunkData

A chunk’s data is not a blob within the encoding’s bound.

§

ChunkRecord

A chunk’s data is not a valid twc1+zstd record.

§

Reference

A chunk record names a target that does not exist or is out of range.

§

ObjectUid

An object_uids row is invalid, or the table does not index exactly the uids of the chunk records.

§

Integrity

SQLite’s integrity check failed.

§

Digest

The file’s SHA-256 does not match its name, or the SHA-256 of a pack opened from bytes is not the digest its caller expects.

§

DecodeBudget

The chunks decode to more than the verification budget, or a single read holds more than its budget: a chunk’s objects and fields, or, in the browser reader, a stairwell’s steps.

§

Invalid

The compiler cannot encode a world.

Implementations§

Source§

impl ErrorCode

Source

pub const ALL: [Self; 28]

Every code, in declaration order.

Source

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

The stable string form, such as pack.free_pages.

Trait Implementations§

Source§

impl Clone for ErrorCode

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 ErrorCode

Source§

impl Debug for ErrorCode

Source§

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

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

impl Display for ErrorCode

Source§

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

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

impl Eq for ErrorCode

Source§

impl Hash for ErrorCode

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 ErrorCode

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 ErrorCode

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

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.