Skip to content

Commit

Permalink
remove ButtonResponse unknown id
Browse files Browse the repository at this point in the history
  • Loading branch information
NotThatRqd committed Oct 29, 2023
1 parent 62d567a commit 0fb0ba5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
9 changes: 0 additions & 9 deletions src/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ use serde::{Deserialize, Serialize};
/// let count_button = Button::new("Count", count_handler);
/// ```
pub struct Button<S: Send + Sync + 'static> {
// todo: add "get_name" and "get_id" which return immutable str slice
pub name: String,
pub handler: Box<dyn (Fn(&S) -> ButtonResponse) + Send + Sync>
}
Expand Down Expand Up @@ -78,11 +77,3 @@ impl From<String> for ButtonResponse {
ButtonResponse { message }
}
}

impl ButtonResponse {
pub(crate) fn unknown_id() -> ButtonResponse {
ButtonResponse {
message: "Unknown button id".to_string()
}
}
}
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async fn post_root<S: Send + Sync>(State(state): State<Arc<BtnifyState<S>>>, Jso

let res = match handler {
Some(handler) => handler(&state.user_state),
None => ButtonResponse::unknown_id()
None => "Unknown button id".into()
};

Json(res)
Expand Down

0 comments on commit 0fb0ba5

Please sign in to comment.