pub enum Error {
    EmptyFile,
    NoHeader,
    HeaderInvalidUTF8,
    UnsupportedGeometryFormat,
    HeaderIncomplete(u8),
    InvalidHeaderValue,
    InvalidGeometryCommand(u16),
    ElementOutsideLayer,
    UnexpectedEOF,
    TypeMismatch,
}
Expand description

Errors encountered when parsing a CLI file

Variants

EmptyFile

File is too short to contain a CLI file.

NoHeader

File does not contain a header section.

HeaderInvalidUTF8

Header does not contain valid UTF-8.

UnsupportedGeometryFormat

The header indicates that this file contains an ASCII encoded geometry section. This library does not support his format at this time.

HeaderIncomplete(u8)

Header is missing a required element:

  • 0: Indication of binary or ASCII geometry section
  • 1: Units
  • 2: Version

InvalidHeaderValue

A numeric header value could not be parsed.

InvalidGeometryCommand(u16)

One of 6 binary commands was expected in the next two bytes, instead, this value was found. Most likely the file is corrupted. It is possible the file contains commands not included in the CLI spec.

A bug in this library may also be present. Please consider submitting the .cli file in a PR. Thank you.

ElementOutsideLayer

The file in invalid because it has geometry elements in the geometry section before specifying the first layer.

UnexpectedEOF

An element in the geometry section indicated that more data was present but the EOF has been reached.

TypeMismatch

The CLIType specified when declaring the CLI parser does not match the data in the geometry section of the file.

Trait Implementations

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The lower-level source of this error, if any. Read more

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.