2019-09-30 19:19:06 +02:00
|
|
|
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! rest_struct {
|
|
|
|
($struct_name:ident { $($field_id:ident : $field_ty:ty),* }) => {
|
|
|
|
#[derive(serde::Deserialize, serde::Serialize)]
|
|
|
|
struct $struct_name
|
|
|
|
{
|
|
|
|
$($field_id : $field_ty),*
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! rest_resource {
|
2019-09-30 20:10:51 +02:00
|
|
|
($res_name:ident, $route:ident => $setup:block) => {
|
2019-09-30 19:19:06 +02:00
|
|
|
struct $res_name;
|
|
|
|
|
|
|
|
impl ::gotham_restful::Resource for $res_name
|
|
|
|
{
|
|
|
|
fn name() -> String
|
|
|
|
{
|
|
|
|
stringify!($res_name).to_string()
|
|
|
|
}
|
|
|
|
|
2019-09-30 20:10:51 +02:00
|
|
|
fn setup<D : ::gotham_restful::DrawResourceRoutes>(mut $route : D) $setup
|
2019-09-30 19:19:06 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|