Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 30 variants BrokenPageList, DuplicateCharCount { line: Option<usize>, }, DuplicateChar { line: Option<usize>, id: u32, }, DuplicateCommonBlock { line: Option<usize>, }, DuplicateInfoBlock { line: Option<usize>, }, DuplicateKerningCount { line: Option<usize>, }, DuplicateKerningPair { line: Option<usize>, first: u32, second: u32, }, DuplicateKey { line: Option<usize>, key: String, }, DuplicatePageId { line: Option<usize>, id: u32, }, DuplicateTag { line: Option<usize>, tag: String, }, IncongruentPageNameLen { line: Option<usize>, }, InvalidBinary { magic_bytes: u32, }, InvalidBinaryBlock { id: u8, }, InvalidCharsetEncoding { unicode: bool, charset: Charset, }, InvalidCharCount { specified: u32, realized: usize, }, InvalidCharPage { char_id: u32, page_id: u32, }, InvalidKerningCount { specified: u32, realized: usize, }, InvalidKerningChar { id: u32, }, InvalidKey { line: Option<usize>, key: String, }, InvalidPageCount { specified: u16, realized: usize, }, InvalidTag { line: Option<usize>, tag: String, }, NoCommonBlock, NoInfoBlock, Parse { line: Option<usize>, entity: String, err: String, }, UnsafeValueString { path: String, value: String, }, UnsupportedBinaryVersion { version: u8, }, UnsupportedEncoding { line: Option<usize>, entity: String, err: String, }, UnsupportedValueEncoding { path: String, value: String, }, Internal { err: String, }, Io { err: Error, },
}
Expand description

Crate errors.

Describes the various errors that may occur when encoding/ decoding/ manipulating BMFont data structures.

The list of variants may change over time. Other than Error::Io and Error::Internal you’ll probably not want to match against them.

From<bmfont_rs::Error> for std::io::Error is provided as a convenience.

The Error::Internal variant indicates malfunctioning library code and should be reported at the project repository home here.

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

BrokenPageList

The specified page ids do not form a coherent/ sequential list (decode only).

§

DuplicateCharCount

Duplicate character count (decode only).

Fields

§line: Option<usize>

Line where the error occurred.

§

DuplicateChar

Duplicate character id.

Fields

§line: Option<usize>

Line where the error occurred.

§id: u32

Duplicate char id.

§

DuplicateCommonBlock

Duplicate common block (decode only).

Fields

§line: Option<usize>

Line where the error occurred.

§

DuplicateInfoBlock

Duplicate info block (decode only).

Fields

§line: Option<usize>

Line where the error occurred.

§

DuplicateKerningCount

Duplicate kerning count (decode only).

Fields

§line: Option<usize>

Line where the error occurred.

§

DuplicateKerningPair

Duplicate kerning pair entry.

Fields

§line: Option<usize>

Line where the error occurred.

§first: u32

Kerning first character id.

§second: u32

Kerning second character id.

§

DuplicateKey

Duplicate tagged key value (decode only).

Fields

§line: Option<usize>

Line where the error occurred.

§key: String

Duplicate key.

§

DuplicatePageId

Duplicate page id (decode only).

Fields

§line: Option<usize>

Line where the error occurred.

§id: u32

Duplicate page id.

§

DuplicateTag

Duplicate tag (decode only).

Fields

§line: Option<usize>

Line where the error occurred.

§tag: String

Duplicate tag.

§

IncongruentPageNameLen

Page name lengths are not all of the same size.

Fields

§line: Option<usize>

Line where the error occurred.

§

InvalidBinary

The input is not a valid BMFont binary file (decode only).

Fields

§magic_bytes: u32

Magic bytes.

§

InvalidBinaryBlock

Invalid binary block (decode only).

Fields

§id: u8

Block id.

§

InvalidCharsetEncoding

Invalid character set encoding.

Fields

§unicode: bool

True if Unicode.

§charset: Charset

Character set encoding.

§

InvalidCharCount

The specified character count does not match the number of realized characters (decode only).

Fields

§specified: u32

Specified count.

§realized: usize

Realized count.

§

InvalidCharPage

The specified character page does not exist.

Fields

§char_id: u32

Character id.

§page_id: u32

Page id.

§

InvalidKerningCount

The specified kerning pair count does not match the number of realized kerning pairs (decode only).

Fields

§specified: u32

Specified count.

§realized: usize

Realized count.

§

InvalidKerningChar

The specified kerning character does not exist.

Fields

§id: u32

Character id.

§

InvalidKey

The tagged key name is not valid (decode only).

Fields

§line: Option<usize>

Line where the error occurred.

§key: String

Invalid key.

§

InvalidPageCount

The specified page count does not match the number of realized pages (decode only).

Fields

§specified: u16

Specified count.

§realized: usize

Realized count.

§

InvalidTag

The tag name is not valid (decode only).

Fields

§line: Option<usize>

Line where the error occurred.

§tag: String

Invalid tag.

§

NoCommonBlock

The common block is missing.

§

NoInfoBlock

The info block is missing.

§

Parse

There was an error parsing an entity.

Fields

§line: Option<usize>

Line where the error occurred.

§entity: String

The entity that failed to parse.

§err: String

The parse error.

§

UnsafeValueString

The value string contains potentially unsafe control characters.

Fields

§path: String

Path/ location.

§value: String

Value.

§

UnsupportedBinaryVersion

The binary version is unsupported (decode only).

Fields

§version: u8

Binary version.

§

UnsupportedEncoding

The specified entity cannot be encoded.

Fields

§line: Option<usize>

Line where the error occurred.

§entity: String

The entity that failed to encode.

§err: String

The encoding error.

§

UnsupportedValueEncoding

The value string contains characters that cannot be encoded.

Fields

§path: String

Path/ location.

§value: String

Value.

§

Internal

Internal error. This should not occur.

Fields

§err: String

Error.

§

Io

Io error.

Fields

§err: Error

IO error

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, f: &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
Source§

impl From<Error> for Error

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Error

§

impl !RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

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