mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-08-17 06:41:03 +02:00
refactor: replace channel macros with ext trait methods
This commit is contained in:
parent
d5744f597c
commit
f929aef2d9
50 changed files with 658 additions and 476 deletions
|
@ -1,7 +1,8 @@
|
|||
#[cfg(feature = "ipc")]
|
||||
use crate::Ironbar;
|
||||
use crate::channels::{AsyncSenderExt, MpscReceiverExt};
|
||||
use crate::script::{OutputStream, Script};
|
||||
use crate::{arc_mut, glib_recv_mpsc, lock, spawn, try_send};
|
||||
use crate::{arc_mut, lock, spawn};
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
/// A segment of a dynamic string,
|
||||
|
@ -25,7 +26,7 @@ enum DynamicStringSegment {
|
|||
/// label.set_label_escaped(&string);
|
||||
/// });
|
||||
/// ```
|
||||
pub fn dynamic_string<F>(input: &str, mut f: F)
|
||||
pub fn dynamic_string<F>(input: &str, f: F)
|
||||
where
|
||||
F: FnMut(String) + 'static,
|
||||
{
|
||||
|
@ -55,7 +56,7 @@ where
|
|||
let _: String = std::mem::replace(&mut label_parts[i], out);
|
||||
|
||||
let string = label_parts.join("");
|
||||
try_send!(tx, string);
|
||||
tx.send_spawn(string);
|
||||
}
|
||||
})
|
||||
.await;
|
||||
|
@ -80,7 +81,7 @@ where
|
|||
let _: String = std::mem::replace(&mut label_parts[i], value);
|
||||
|
||||
let string = label_parts.join("");
|
||||
try_send!(tx, string);
|
||||
tx.send_spawn(string);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -88,12 +89,12 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
glib_recv_mpsc!(rx , val => f(val));
|
||||
rx.recv_glib(f);
|
||||
|
||||
// initialize
|
||||
if is_static {
|
||||
let label_parts = lock!(label_parts).join("");
|
||||
try_send!(tx, label_parts);
|
||||
tx.send_spawn(label_parts);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue