mirror of
https://github.com/chatmail/core.git
synced 2026-04-22 07:56:29 +03:00
cleanup and fix earlier introduced scoping error
This commit is contained in:
committed by
holger krekel
parent
6be3c9a48a
commit
e710836276
@@ -4,6 +4,7 @@ use std::str;
|
||||
|
||||
use num_traits::FromPrimitive;
|
||||
|
||||
use crate::dc_mimeparser::SystemMessage;
|
||||
use crate::error;
|
||||
|
||||
/// Available param keys.
|
||||
@@ -178,6 +179,13 @@ impl Params {
|
||||
self.get(key).and_then(|s| s.parse().ok())
|
||||
}
|
||||
|
||||
/// Get the parameter behind `Param::Cmd` interpreted as `SystemMessage`.
|
||||
pub fn get_cmd(&self) -> SystemMessage {
|
||||
self.get_int(Param::Cmd)
|
||||
.and_then(SystemMessage::from_i32)
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
/// Get the given parameter and parse as `f64`.
|
||||
pub fn get_float(&self, key: Param) -> Option<f64> {
|
||||
self.get(key).and_then(|s| s.parse().ok())
|
||||
|
||||
Reference in New Issue
Block a user