pub struct Route {
pub path: String,
pub handler: Arc<dyn Handler>,
}Expand description
Represents a single route with its path and handler.
Routes map message patterns (paths) to handler functions.
This is typically used internally by the Router.
§Examples
use wsforge::prelude::*;
async fn my_handler() -> Result<String> {
Ok("response".to_string())
}
let route = Route {
path: "/api/message".to_string(),
handler: handler(my_handler),
};Fields§
§path: StringThe route path (e.g., “/chat”, “/api/users”)
handler: Arc<dyn Handler>The handler for this route
Auto Trait Implementations§
impl Freeze for Route
impl !RefUnwindSafe for Route
impl Send for Route
impl Sync for Route
impl Unpin for Route
impl !UnwindSafe for Route
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