html_form_actions/lib.rs
1#![cfg_attr(not(test), no_std)]
2
3mod tests;
4
5pub use html_form_actions_macros::actions;
6
7pub fn query_action(raw_query: Option<&str>) -> Option<&str> {
8 raw_query?
9 .split('&')
10 .find(|entry| !entry.contains('=') && entry.starts_with('/'))
11}
12
13/// A helper trait for composing routers with generated routes.
14pub trait BuildExt: Sized {
15 /// Apply `item` to the current router, returning the new router.
16 fn with<U>(self, item: impl FnOnce(Self) -> U) -> U {
17 item(self)
18 }
19}
20
21impl<T: Sized> BuildExt for T {}