pub enum Route<'lf> {
Stack(&'lf str, &'lf [Route<'lf>]),
Tail(Method, &'lf str, Function),
}Expand description
A quick way of nesting routes inside of eachother stacks can contain either yet another stack, or a tail, which will act as an API-endpoint. This enum is used for the server config when initializing the server.
§Examples
/*- Initiaize routes -*/
let routes = Route::Stack("", &[
Route::Stack("nest1", &[
Route::Tail(Method::POST, "value", Function::S(|_| {})),
Route::Stack("nest2", &[
Route::Tail(Method::GET, "value1", Function::S(|_| {})),
Route::Tail(Method::GET, "value2", Function::S(|_| {})),
]),
]),
]);Variants§
Trait Implementations§
Auto Trait Implementations§
impl<'lf> Freeze for Route<'lf>
impl<'lf> RefUnwindSafe for Route<'lf>
impl<'lf> Send for Route<'lf>
impl<'lf> Sync for Route<'lf>
impl<'lf> Unpin for Route<'lf>
impl<'lf> UnwindSafe for Route<'lf>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more