pub enum Error {
    Sys(UErrorCode),
    Wrapper(Error),
}
Expand description

Represents a Unicode error, resulting from operations of low-level ICU libraries.

This is modeled after absl::Status in the Abseil library, which provides ways for users to avoid dealing with all the numerous error codes directly.

Variants

Sys(UErrorCode)

The error originating in the underlying sys library.

At the moment it is possible to produce an Error which has a zero error code (i.e. no error), because it makes it unnecessary for users to deal with error codes directly. It does make for a bit weird API, so we may turn it around a bit. Ideally, it should not be possible to have an Error that isn’t really an error.

Wrapper(Error)

Errors originating from the wrapper code. For example when pre-converting input into UTF8 for input that happens to be malformed.

Implementations

The error code denoting no error has happened.

Returns true if this error code corresponds to no error.

Creates a new error from the supplied status. Ok is returned if the error code does not correspond to an error code (as opposed to OK or a warning code).

Creates a new error from the supplied status. Ok is returned if the error code does not constitute an error in preflight mode.

This error check explicitly ignores the buffer overflow error when reporting whether it contains an error condition.

Preflight calls to ICU libraries do a read-only scan of the input to determine the buffer sizes required on the output in case of conversion calls such as ucal_strFromUTF8. The way this call is made is to offer a zero-capacity buffer (which could be pointed to by a NULL pointer), and then call the respective function. The function will compute the buffer size, but will also return a bogus buffer overflow error.

Returns true if this error has the supplied code.

Returns true if the error is an error, not a warning.

The ICU4C library has error codes for errors and warnings.

Return true if there was an error in a preflight call.

This error check explicitly ignores the buffer overflow error when reporting whether it contains an error condition.

Preflight calls to ICU libraries do a read-only scan of the input to determine the buffer sizes required on the output in case of conversion calls such as ucal_strFromUTF8. The way this call is made is to offer a zero-capacity buffer (which could be pointed to by a NULL pointer), and then call the respective function. The function will compute the buffer size, but will also return a bogus buffer overflow error.

Returns true if the error is, in fact, a warning (nonfatal).

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

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts this type into the (usually inferred) input type.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.