Enum poke_a_mango::Error
[−]
[src]
pub enum Error {
FileParsingFailed {
desc: &'static str,
errors: Vec<String>,
},
Io {
desc: &'static str,
op: &'static str,
},
Ui {
desc: &'static str,
error: String,
},
}Enum representing all possible ways the application can fail.
Variants
FileParsingFailedFailed to parse the specified file because of the specified errors.
Fields of FileParsingFailed
desc: &'static str | The file that failed to parse. |
errors: Vec<String> | The parsing errors that occured. |
IoAn I/O error occured.
This includes higher-level I/O errors like FS ones.
Fields of Io
desc: &'static str | The file that failed to parse. |
op: &'static str | The failed operation. This should be lowercase and imperative ("create", "open"). |
UiA UI error, like a failure to creat a Window.
Fields of Ui
desc: &'static str | The UI operation's description. This should be imperative. |
error: String | The failed operation, as returned by the UI framework. |
Methods
impl Error[src]
pub fn print_error<W: Write>(&self, err_out: &mut W)[src]
Get the executable exit value from an Error instance.
Examples
let mut out = Vec::new(); Error::Io { desc: "leaderboard", op: "write", }.print_error(&mut out); assert_eq!(String::from_iter(out.iter().map(|&i| i as char)), "Writing leaderboard failed.\n".to_string());
pub fn exit_value(&self) -> i32[src]
Get the executable exit value from an Error instance.
Examples
assert_eq!(Error::FileParsingFailed { desc: "", errors: vec![], }.exit_value(), 1);
Trait Implementations
impl Debug for Error[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result[src]
Formats the value using the given formatter. Read more
impl Clone for Error[src]
fn clone(&self) -> Error[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl Hash for Error[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)[src]
Feeds this value into the given [Hasher]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher]. Read more
impl PartialEq for Error[src]
fn eq(&self, __arg_0: &Error) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Error) -> bool[src]
This method tests for !=.