Skip to main content

CliError

Enum CliError 

Source
pub enum CliError {
Show 22 variants InvalidArgument { arg: String, value: String, reason: String, hint: Option<String>, }, MissingArgument { arg: String, context: String, }, ConflictingArguments { arg1: String, arg2: String, reason: String, }, InvalidArgumentCombination { args: Vec<String>, reason: String, }, ConfigIo { path: PathBuf, message: String, }, ConfigParse { path: PathBuf, message: String, line: Option<usize>, }, ConfigValue { path: PathBuf, key: String, value: String, reason: String, }, RomLoad { path: PathBuf, message: String, }, RomNotFound { path: PathBuf, }, RomInvalid { path: PathBuf, reason: String, }, SavestateLoad { source: String, message: String, }, SavestateSave { destination: String, message: String, }, SavestateInvalid { source: String, reason: String, }, InvalidAddress { address: String, reason: String, }, InvalidMemoryRange { range: String, reason: String, hint: Option<String>, }, MemoryAccess { operation: String, address: u16, message: String, }, Execution { message: String, cycles: Option<u128>, frames: Option<u64>, }, InvalidStopCondition { condition: String, reason: String, hint: Option<String>, }, OutputWrite { destination: String, message: String, }, InvalidOutputFormat { format: String, valid_formats: Vec<String>, }, Io { operation: String, message: String, }, Internal { message: String, },
}
Expand description

Comprehensive error type for CLI operations.

This enum covers all possible error conditions in the CLI module, providing structured information for error handling and reporting.

Variants§

§

InvalidArgument

Invalid argument value

Fields

§value: String
§reason: String
§

MissingArgument

Missing required argument

Fields

§context: String
§

ConflictingArguments

Conflicting arguments specified

Fields

§arg1: String
§arg2: String
§reason: String
§

InvalidArgumentCombination

Invalid combination of arguments

Fields

§args: Vec<String>
§reason: String
§

ConfigIo

Failed to read config file

Fields

§path: PathBuf
§message: String
§

ConfigParse

Failed to parse config file

Fields

§path: PathBuf
§message: String
§

ConfigValue

Invalid config value

Fields

§path: PathBuf
§value: String
§reason: String
§

RomLoad

Failed to load ROM

Fields

§path: PathBuf
§message: String
§

RomNotFound

ROM not found

Fields

§path: PathBuf
§

RomInvalid

Invalid ROM format

Fields

§path: PathBuf
§reason: String
§

SavestateLoad

Failed to load savestate

Fields

§source: String
§message: String
§

SavestateSave

Failed to save savestate

Fields

§destination: String
§message: String
§

SavestateInvalid

Invalid savestate format

Fields

§source: String
§reason: String
§

InvalidAddress

Invalid memory address

Fields

§address: String
§reason: String
§

InvalidMemoryRange

Invalid memory range

Fields

§range: String
§reason: String
§

MemoryAccess

Memory access error

Fields

§operation: String
§address: u16
§message: String
§

Execution

Execution error

Fields

§message: String
§cycles: Option<u128>
§frames: Option<u64>
§

InvalidStopCondition

Invalid stop condition

Fields

§condition: String
§reason: String
§

OutputWrite

Failed to write output

Fields

§destination: String
§message: String
§

InvalidOutputFormat

Invalid output format

Fields

§format: String
§valid_formats: Vec<String>
§

Io

I/O error

Fields

§operation: String
§message: String
§

Internal

Internal error (should not happen)

Fields

§message: String

Implementations§

Source§

impl CliError

Source

pub fn invalid_arg( arg: impl Into<String>, value: impl Into<String>, reason: impl Into<String>, ) -> Self

Create an invalid argument error.

Source

pub fn invalid_arg_with_hint( arg: impl Into<String>, value: impl Into<String>, reason: impl Into<String>, hint: impl Into<String>, ) -> Self

Create an invalid argument error with a hint.

Source

pub fn missing_arg(arg: impl Into<String>, context: impl Into<String>) -> Self

Create a missing argument error.

Source

pub fn conflicting_args( arg1: impl Into<String>, arg2: impl Into<String>, reason: impl Into<String>, ) -> Self

Create a conflicting arguments error.

Source

pub fn config_io(path: impl Into<PathBuf>, err: impl Display) -> Self

Create a config I/O error.

Source

pub fn config_parse(path: impl Into<PathBuf>, err: impl Display) -> Self

Create a config parse error.

Source

pub fn invalid_memory_range( range: impl Into<String>, reason: impl Into<String>, ) -> Self

Create an invalid memory range error.

Source

pub fn invalid_address( address: impl Into<String>, reason: impl Into<String>, ) -> Self

Create an invalid address error.

Source

pub fn savestate_load(source: impl Into<String>, err: impl Display) -> Self

Create a savestate load error.

Source

pub fn savestate_save(destination: impl Into<String>, err: impl Display) -> Self

Create a savestate save error.

Source

pub fn execution(message: impl Into<String>) -> Self

Create an execution error.

Source

pub fn invalid_stop_condition( condition: impl Into<String>, reason: impl Into<String>, ) -> Self

Create an invalid stop condition error.

Source

pub fn output_write(destination: impl Into<String>, err: impl Display) -> Self

Create an output write error.

Source

pub fn io(operation: impl Into<String>, err: impl Display) -> Self

Create an I/O error.

Source

pub fn internal(message: impl Into<String>) -> Self

Create an internal error.

Source

pub fn is_user_error(&self) -> bool

Check if this is a user error (invalid input).

Source

pub fn is_io_error(&self) -> bool

Check if this is an I/O error.

Source

pub fn exit_code(&self) -> u8

Get the exit code for this error.

Trait Implementations§

Source§

impl Clone for CliError

Source§

fn clone(&self) -> CliError

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CliError

Source§

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

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

impl Display for CliError

Source§

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

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

impl Error for CliError

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 CliError

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for CliError

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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 = 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.