Simplify MacrosExt helper
This commit is contained in:
parent
95d1324473
commit
5f60aaccce
1 changed files with 5 additions and 6 deletions
|
@ -72,18 +72,17 @@ impl ConnectionMut for Option<Connection> {
|
|||
|
||||
trait MacrosExt {
|
||||
fn get_string(&self, name: &CStr) -> Option<Cow<'_, str>>;
|
||||
fn queue_id(&self) -> Cow<'_, str>;
|
||||
|
||||
fn queue_id(&self) -> Cow<'_, str> {
|
||||
self.get_string(c_str!("i"))
|
||||
.unwrap_or_else(|| "NONE".into())
|
||||
}
|
||||
}
|
||||
|
||||
impl MacrosExt for Macros {
|
||||
fn get_string(&self, name: &CStr) -> Option<Cow<'_, str>> {
|
||||
self.get(name).map(|v| v.to_string_lossy())
|
||||
}
|
||||
|
||||
fn queue_id(&self) -> Cow<'_, str> {
|
||||
self.get_string(c_str!("i"))
|
||||
.unwrap_or_else(|| "NONE".into())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn make_callbacks(config: Config) -> Callbacks<Connection> {
|
||||
|
|
Loading…
Reference in a new issue