mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-07-03 03:31:03 +02:00
refactor(custom): reduce a lot of repeated code
This commit is contained in:
parent
a9d1233909
commit
3613aef5c5
8 changed files with 85 additions and 97 deletions
|
@ -19,6 +19,15 @@ pub struct DynamicString;
|
|||
impl DynamicString {
|
||||
/// Creates a new dynamic string, based off the input template.
|
||||
/// Runs `f` with the compiled string each time one of the scripts updates.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rs
|
||||
/// DynamicString::new(&text, move |string| {
|
||||
/// label.set_markup(&string);
|
||||
/// Continue(true)
|
||||
/// });
|
||||
/// ```
|
||||
pub fn new<F>(input: &str, f: F) -> Self
|
||||
where
|
||||
F: FnMut(String) -> Continue + 'static,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue