Skip to main content

ImportError

Enum ImportError 

Source
#[non_exhaustive]
pub enum ImportError<E> { Write { path: Utf8PathBuf, source: Error, }, Config(ModProjectError), Cancelled, Refused(ConfigRefusal), Format(E), }
Expand description

Failure to import a packaged mod as a mod project.

The variants here are the driver’s: they can occur whatever format is being imported. Format-specific failures arrive through the transparent Format variant, so matching on a concrete format’s error is one level deep: ImportError::Format(inner).

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

Write

A directory could not be created under the output directory.

Fields

§source: Error
§

Config(ModProjectError)

The imported project’s mod.config.json could not be written.

§

Cancelled

The cancellation given to with_cancellation answered true. The output directory holds however much of the project had been written, and removing it is the caller’s.

§

Refused(ConfigRefusal)

The config hook given to try_with_config refused the project the archive described.

The output directory holds the content the format extracted, as it does after a cancellation: the hook judges what was decoded, so it can only answer once the format has run. Removing the directory is the caller’s.

The reason is the caller’s own error, boxed. A caller that wants its type back downcasts: error.downcast_ref::<MyError>().

§

Format(E)

The format failed to decode the archive; see the format’s own error type for the cases.

Trait Implementations§

Source§

impl<E: Debug> Debug for ImportError<E>

Source§

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

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

impl<E> Display for ImportError<E>
where E: Display,

Source§

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

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

impl<E> Error for ImportError<E>
where E: Error, Self: Debug + Display,

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<E> From<ModProjectError> for ImportError<E>

Source§

fn from(source: ModProjectError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<E> !RefUnwindSafe for ImportError<E>

§

impl<E> !UnwindSafe for ImportError<E>

§

impl<E> Freeze for ImportError<E>
where E: Freeze,

§

impl<E> Send for ImportError<E>
where E: Send,

§

impl<E> Sync for ImportError<E>
where E: Sync,

§

impl<E> Unpin for ImportError<E>
where E: Unpin,

§

impl<E> UnsafeUnpin for ImportError<E>
where E: UnsafeUnpin,

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.