pub struct ApiMethodRouter<S = ()> { /* private fields */ }Expand description
Wrapper around ApiMethodRouter that provides method chaining for documented handlers.
This type is returned by routing functions like get(), post(), etc. and allows
chaining methods with the exact same names as axum (.post(), .patch(), etc.) while
accepting documented handlers decorated with #[rovo].
§Example
use rovo::{Router, rovo, routing::{get, post, patch, delete}, aide::axum::IntoApiResponse};
use rovo::response::Json;
#[rovo]
async fn list_items() -> impl IntoApiResponse { Json(()) }
#[rovo]
async fn create_item() -> impl IntoApiResponse { Json(()) }
#[rovo]
async fn get_item() -> impl IntoApiResponse { Json(()) }
#[rovo]
async fn update_item() -> impl IntoApiResponse { Json(()) }
#[rovo]
async fn delete_item() -> impl IntoApiResponse { Json(()) }
Router::new()
.route("/items", get(list_items).post(create_item))
.route("/items/{id}", get(get_item).patch(update_item).delete(delete_item));Implementations§
Source§impl<S> ApiMethodRouter<S>
impl<S> ApiMethodRouter<S>
Sourcepub const fn new(inner: ApiMethodRouter<S>) -> Self
pub const fn new(inner: ApiMethodRouter<S>) -> Self
Create a new ApiMethodRouter from aide’s ApiMethodRouter
Sourcepub fn post<H>(self, handler: H) -> Selfwhere
H: IntoApiMethodRouter<S>,
pub fn post<H>(self, handler: H) -> Selfwhere
H: IntoApiMethodRouter<S>,
Chain a POST handler
Sourcepub fn get<H>(self, handler: H) -> Selfwhere
H: IntoApiMethodRouter<S>,
pub fn get<H>(self, handler: H) -> Selfwhere
H: IntoApiMethodRouter<S>,
Chain a GET handler
Sourcepub fn patch<H>(self, handler: H) -> Selfwhere
H: IntoApiMethodRouter<S>,
pub fn patch<H>(self, handler: H) -> Selfwhere
H: IntoApiMethodRouter<S>,
Chain a PATCH handler
Sourcepub fn delete<H>(self, handler: H) -> Selfwhere
H: IntoApiMethodRouter<S>,
pub fn delete<H>(self, handler: H) -> Selfwhere
H: IntoApiMethodRouter<S>,
Chain a DELETE handler
Sourcepub fn put<H>(self, handler: H) -> Selfwhere
H: IntoApiMethodRouter<S>,
pub fn put<H>(self, handler: H) -> Selfwhere
H: IntoApiMethodRouter<S>,
Chain a PUT handler
Trait Implementations§
Source§impl<S> From<ApiMethodRouter<S>> for ApiMethodRouter<S>
impl<S> From<ApiMethodRouter<S>> for ApiMethodRouter<S>
Source§fn from(router: ApiMethodRouter<S>) -> Self
fn from(router: ApiMethodRouter<S>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<S> Freeze for ApiMethodRouter<S>
impl<S = ()> !RefUnwindSafe for ApiMethodRouter<S>
impl<S> Send for ApiMethodRouter<S>
impl<S> Sync for ApiMethodRouter<S>
impl<S> Unpin for ApiMethodRouter<S>
impl<S = ()> !UnwindSafe for ApiMethodRouter<S>
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