1
0
Fork 0
mirror of https://gitlab.com/msrd0/gotham-restful.git synced 2025-02-23 21:12:28 +00:00
deprecated-gotham-restful/src/resource.rs

24 lines
481 B
Rust
Raw Normal View History

2019-09-27 15:35:02 +02:00
use crate::{DrawResourceRoutes, ResourceResult};
2019-09-26 17:24:40 +02:00
use gotham::state::State;
2019-09-27 15:35:02 +02:00
use serde::de::DeserializeOwned;
2019-09-26 17:24:40 +02:00
pub trait Resource
{
2019-09-27 15:35:02 +02:00
fn setup<D : DrawResourceRoutes>(route : D);
2019-09-26 17:24:40 +02:00
}
2019-09-27 15:35:02 +02:00
pub trait IndexResource<R : ResourceResult>
2019-09-26 17:24:40 +02:00
{
2019-09-27 15:35:02 +02:00
fn index(state : &mut State) -> R;
2019-09-26 17:24:40 +02:00
}
2019-09-27 15:35:02 +02:00
pub trait GetResource<ID : DeserializeOwned>
2019-09-26 17:24:40 +02:00
{
2019-09-27 15:35:02 +02:00
fn get(state : State, id : ID) -> dyn ResourceResult;
2019-09-26 17:24:40 +02:00
}
2019-09-27 15:35:02 +02:00
pub trait PostResource<Body : DeserializeOwned>
2019-09-26 17:24:40 +02:00
{
2019-09-27 15:35:02 +02:00
fn post(state : State, body : Body) -> dyn ResourceResult;
2019-09-26 17:24:40 +02:00
}