✨ feat(eol_action): add parse method to EolAction
- implement `parse` method for `EolAction` to convert strings to `EolAction` variants - support "trash" and "delete" strings, return `None` for others
This commit is contained in:
committed by
Jeremiah Russell
parent
3673c059f3
commit
9c237d8681
@@ -20,3 +20,14 @@ impl fmt::Display for EolAction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl EolAction {
|
||||||
|
/// Parse a string to a valid `EolAction` variant or return `None`.
|
||||||
|
pub fn parse(str: &str) -> Option<EolAction> {
|
||||||
|
match str.to_lowercase().as_str() {
|
||||||
|
"trash" => Some(EolAction::Trash),
|
||||||
|
"delete" => Some(EolAction::Delete),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user