mirror of
https://github.com/encounter/rust-sdl2.git
synced 2026-07-10 21:18:41 -07:00
Implement Display for PrefPathError.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use std::ffi::{CStr, CString, NulError};
|
||||
use std::fmt;
|
||||
use get_error;
|
||||
use libc::c_char;
|
||||
|
||||
@@ -24,6 +25,18 @@ pub enum PrefPathError {
|
||||
SdlError(String),
|
||||
}
|
||||
|
||||
impl fmt::Display for PrefPathError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
use self::PrefPathError::*;
|
||||
|
||||
match *self {
|
||||
InvalidOrganizationName(ref e) => write!(f, "Invalid organization name: {}", e),
|
||||
InvalidApplicationName(ref e) => write!(f, "Invalid application name: {}", e),
|
||||
SdlError(ref e) => write!(f, "SDL error: {}", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Change to OsStr or something?
|
||||
/// Return the preferred directory for the application to write files on this
|
||||
/// system, based on the given organization and application name.
|
||||
|
||||
Reference in New Issue
Block a user