mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-29 00:00:18 +02:00
checkpoint
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
use axum::{body::Body, Router};
|
||||
|
||||
mod resource;
|
||||
mod typed_path;
|
||||
pub mod typed_path;
|
||||
|
||||
pub use self::{resource::Resource, typed_path::TypedPath};
|
||||
|
||||
|
||||
@@ -1,10 +1,25 @@
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use axum::extract::{FromRequest, Path};
|
||||
use serde::de::DeserializeOwned;
|
||||
use std::borrow::Cow;
|
||||
|
||||
/// TODO
|
||||
pub trait TypedPath {
|
||||
/// TODO
|
||||
/// ```rust
|
||||
/// use axum_macros::TypedPath;
|
||||
///
|
||||
/// #[derive(TypedPath)]
|
||||
/// #[typed_path("/users/:id")]
|
||||
/// struct UsersShow {
|
||||
/// id: u32,
|
||||
/// }
|
||||
/// ```
|
||||
pub trait TypedPath<B>: FromRequest<B> + DeserializeOwned {
|
||||
const PATH: &'static str;
|
||||
|
||||
/// TODO
|
||||
fn path(&self) -> Cow<'static, str>;
|
||||
}
|
||||
|
||||
// pub trait FirstElementIsPath {}
|
||||
// impl<P> FirstElementIsPath for (Path<P>,) {}
|
||||
// impl<P, T1> FirstElementIsPath for (Path<P>, T1) {}
|
||||
// impl<P, T1, T2> FirstElementIsPath for (Path<P>, T1, T2) {}
|
||||
|
||||
Reference in New Issue
Block a user