Skip to content

Commit

Permalink
Make label generic over Into<String> (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmoulton authored Aug 23, 2023
1 parent 020c5d9 commit 2dfaf18
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/views/label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ pub struct Label {
text_overflow: TextOverflow,
}

pub fn label(label: impl Fn() -> String + 'static) -> Label {
pub fn label<S: Into<String> + 'static>(label: impl Fn() -> S + 'static) -> Label {
let cx = ViewContext::get_current();
let id = cx.new_id();
create_effect(move |_| {
let new_label = label();
let new_label = Into::<String>::into(label());
id.update_state(new_label, false);
});
Label {
Expand Down

0 comments on commit 2dfaf18

Please sign in to comment.