pub struct Router<State> { /* private fields */ }
Expand description
A router for actions that can be invoked as services.
Implementations§
Source§impl<State> Router<State>
impl<State> Router<State>
Sourcepub fn capture<T>(&self, path: impl AsRef<str>) -> Result<T, PathError>where
T: DeserializeOwned,
pub fn capture<T>(&self, path: impl AsRef<str>) -> Result<T, PathError>where
T: DeserializeOwned,
Given a path, attempt to deserialize the path fragments into a given type.
Sourcepub fn handle_frame_with_state(&self, frame: Frame, state: State) -> FrameFuture ⓘ
pub fn handle_frame_with_state(&self, frame: Frame, state: State) -> FrameFuture ⓘ
Call an action with a given state.
Sourcepub fn insert<ActionHandler, Args>(
&mut self,
route: impl Into<String>,
given_action: ActionHandler,
) -> Result<()>
pub fn insert<ActionHandler, Args>( &mut self, route: impl Into<String>, given_action: ActionHandler, ) -> Result<()>
Insert a new action into the router, turning it into an [ActionEndpoint
].
Trait Implementations§
Auto Trait Implementations§
impl<State> Freeze for Router<State>
impl<State> !RefUnwindSafe for Router<State>
impl<State> Send for Router<State>
impl<State> Sync for Router<State>
impl<State> Unpin for Router<State>
impl<State> !UnwindSafe for Router<State>
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