Skip to content

Commit

Permalink
Make route take mut self
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmerlin committed May 15, 2024
1 parent bd0c68b commit 8fa780f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/egui_router/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,15 @@ impl<State> EguiRouter<State> {
self
}

pub fn route(&mut self, route: impl Into<String>, handler: impl Handler<State> + 'static) {
pub fn route(
mut self,
route: impl Into<String>,
handler: impl Handler<State> + 'static,
) -> Self {
self.router
.insert(route.into(), Box::new(handler))
.expect("Invalid route");
self
}

pub fn navigate_transition(
Expand Down

0 comments on commit 8fa780f

Please sign in to comment.