Skip to main content

MimeError

Enum MimeError 

Source
pub enum MimeError {
Show 23 variants InvalidGlobWeight { weight: u16, }, InvalidMagicMatcher { reason: String, }, InvalidXmlAttribute { element: String, attribute: String, value: String, reason: String, }, InvalidXmlElement { element: String, reason: String, }, InvalidClassifierInput { reason: String, }, DuplicateDetectorName { name: String, }, EmptyDetectorName, InvalidDetectorName { name: String, reason: String, }, UnknownDetector { name: String, }, DetectorUnavailable { name: String, reason: String, }, NoAvailableDetector { reason: String, }, DetectorBackend { backend: String, reason: String, }, DuplicateClassifierName { name: String, }, EmptyClassifierName, InvalidClassifierName { name: String, reason: String, }, UnknownClassifier { name: String, }, ClassifierUnavailable { name: String, reason: String, }, NoAvailableClassifier { reason: String, }, ClassifierBackend { backend: String, reason: String, }, Xml(Error), Io(Error), Command(CommandError), Config(ConfigError),
}
Expand description

Error type for MIME repository parsing and I/O backed detection.

Variants§

§

InvalidGlobWeight

A glob weight was outside the freedesktop MIME range 0..=100.

Fields

§weight: u16

Invalid glob weight.

§

InvalidMagicMatcher

A magic matcher definition is internally inconsistent.

Fields

§reason: String

Human-readable validation failure.

§

InvalidXmlAttribute

An XML attribute is missing or malformed.

Fields

§element: String

Element carrying the invalid attribute.

§attribute: String

Invalid attribute name.

§value: String

Invalid attribute value.

§reason: String

Human-readable validation failure.

§

InvalidXmlElement

An XML element is missing required content or has invalid children.

Fields

§element: String

Invalid element name.

§reason: String

Human-readable validation failure.

§

InvalidClassifierInput

A detector or classifier input cannot be processed.

Fields

§reason: String

Human-readable validation failure.

§

DuplicateDetectorName

A detector provider name or alias is already registered.

Fields

§name: String

Duplicate provider name or alias.

§

EmptyDetectorName

A detector provider name or alias is empty.

§

InvalidDetectorName

A detector provider name or alias is malformed.

Fields

§name: String

Invalid provider name.

§reason: String

Human-readable validation failure.

§

UnknownDetector

A detector provider could not be found.

Fields

§name: String

Requested provider name or alias.

§

DetectorUnavailable

A detector provider exists but is not available in this environment.

Fields

§name: String

Requested provider name or alias.

§reason: String

Human-readable unavailability reason.

§

NoAvailableDetector

No configured detector provider could be created.

Fields

§reason: String

Human-readable failure summary.

§

DetectorBackend

A detector backend failed with an implementation-specific error.

Fields

§backend: String

Backend identifier.

§reason: String

Human-readable failure reason.

§

DuplicateClassifierName

A media stream classifier provider name or alias is already registered.

Fields

§name: String

Duplicate provider name or alias.

§

EmptyClassifierName

A media stream classifier provider name or alias is empty.

§

InvalidClassifierName

A media stream classifier provider name or alias is malformed.

Fields

§name: String

Invalid provider name.

§reason: String

Human-readable validation failure.

§

UnknownClassifier

A media stream classifier provider could not be found.

Fields

§name: String

Requested provider name or alias.

§

ClassifierUnavailable

A media stream classifier provider exists but is not available in this environment.

Fields

§name: String

Requested provider name or alias.

§reason: String

Human-readable unavailability reason.

§

NoAvailableClassifier

No configured media stream classifier provider could be created.

Fields

§reason: String

Human-readable failure summary.

§

ClassifierBackend

A media stream classifier backend failed with an implementation-specific error.

Fields

§backend: String

Backend identifier.

§reason: String

Human-readable failure reason.

§

Xml(Error)

The XML document could not be parsed.

§

Io(Error)

Detection from a path or reader failed due to I/O.

§

Command(CommandError)

Detection using an external command failed.

§

Config(ConfigError)

Loading MIME configuration failed.

Implementations§

Source§

impl MimeError

Source

pub fn detector_backend( backend: impl Into<String>, reason: impl Into<String>, ) -> Self

Builds a detector backend error.

§Parameters
  • backend: Detector backend identifier.
  • reason: Why the backend failed.
§Returns

A MimeError::DetectorBackend value.

Trait Implementations§

Source§

impl Debug for MimeError

Source§

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

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

impl Display for MimeError

Source§

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

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

impl Error for MimeError

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<CommandError> for MimeError

Source§

fn from(source: CommandError) -> Self

Converts to this type from the input type.
Source§

impl From<ConfigError> for MimeError

Source§

fn from(source: ConfigError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for MimeError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for MimeError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<ProviderRegistryError> for MimeError

Source§

fn from(error: ProviderRegistryError) -> Self

Converts a generic SPI registry error into a MIME-domain error.

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> 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, D> IntoConfigDefault<T> for D
where D: IntoValueDefault<T>,

Source§

fn into_config_default(self) -> T

Converts this fallback value into T.
Source§

impl<T> IntoValueDefault<T> for T

Source§

fn into_value_default(self) -> T

Converts this argument into the default value.
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.