diff --git a/Cargo.toml b/Cargo.toml index 526725b..58a2500 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "btnify" -version = "0.1.0" +version = "0.2.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/button.rs b/src/button.rs index 115e860..c0b9dd0 100644 --- a/src/button.rs +++ b/src/button.rs @@ -37,7 +37,6 @@ use serde::{Deserialize, Serialize}; pub struct Button { // todo: add "get_name" and "get_id" which return immutable str slice pub name: String, - pub id: String, pub handler: Box ButtonResponse) + Send + Sync> } @@ -48,10 +47,10 @@ impl Button { /// /// `Handler` is a function or closure that takes a reference to a user provided state (`S`) and /// returns `ButtonResponse`. It will be called whenever this button is pressed. + // todo: implement Button::from<&str> pub fn new ButtonResponse + 'static>(name: &str, handler: T) -> Button { Button { name: name.to_string(), - id: name.to_lowercase(), handler: Box::new(handler) } } @@ -59,7 +58,7 @@ impl Button { #[derive(Deserialize, Debug)] pub(crate) struct ButtonInfo { - pub id: String + pub id: usize // todo: allow any extra data to be sent } diff --git a/src/html_utils.rs b/src/html_utils.rs index eac35c6..6ad2cec 100644 --- a/src/html_utils.rs +++ b/src/html_utils.rs @@ -11,7 +11,6 @@ pub(super) fn create_page_html<'a, S: Send + Sync + 'static>(buttons: impl Itera {} -