Impl From<&str> for FileIDType, use implementation in From<String> for FileIDType

This commit is contained in:
Matthias Beyer 2015-12-03 17:36:52 +01:00
parent f25e3683a1
commit ce4d99384b

View file

@ -31,10 +31,10 @@ impl Into<String> for FileIDType {
} }
impl From<String> for FileIDType { impl<'a> From<&'a str> for FileIDType {
fn from(s: String) -> FileIDType { fn from(s: &'a str) -> FileIDType {
match &s[..] { match s {
"UUID" => FileIDType::UUID, "UUID" => FileIDType::UUID,
_ => FileIDType::NONE, _ => FileIDType::NONE,
} }
@ -42,6 +42,14 @@ impl From<String> for FileIDType {
} }
impl From<String> for FileIDType {
fn from(s: String) -> FileIDType {
FileIDType::from(&s[..])
}
}
#[derive(Clone)] #[derive(Clone)]
pub struct FileID { pub struct FileID {
id: Option<String>, id: Option<String>,