1
0
Fork 0
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:
Jake Stanger 2023-04-10 13:51:07 +01:00
parent a9d1233909
commit 3613aef5c5
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
8 changed files with 85 additions and 97 deletions

View file

@ -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,