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

79 lines
1.7 KiB
Rust
Raw Normal View History

2019-09-27 16:36:38 +02:00
#[macro_use] extern crate gotham_derive;
#[macro_use] extern crate serde;
2019-09-26 17:24:40 +02:00
pub use hyper::StatusCode;
2019-10-01 00:49:13 +02:00
use serde::{de::DeserializeOwned, Serialize};
2019-09-26 17:24:40 +02:00
2019-10-06 15:03:30 +02:00
pub use gotham_restful_derive::*;
/// Not public API
#[doc(hidden)]
pub mod export
{
#[cfg(feature = "openapi")]
pub use indexmap::IndexMap;
#[cfg(feature = "openapi")]
pub use openapiv3;
}
2019-09-30 19:19:06 +02:00
pub mod helper;
2019-09-29 21:15:22 +02:00
#[cfg(feature = "openapi")]
pub mod openapi;
2019-09-30 18:18:10 +02:00
#[cfg(feature = "openapi")]
2019-09-30 20:58:15 +02:00
pub use openapi::{
router::{GetOpenapi, OpenapiRouter},
2019-10-01 15:33:05 +02:00
types::{OpenapiSchema, OpenapiType}
2019-09-30 20:58:15 +02:00
};
2019-09-29 21:15:22 +02:00
2019-09-26 17:24:40 +02:00
mod resource;
pub use resource::{
Resource,
2019-09-28 13:38:08 +02:00
ResourceReadAll,
ResourceRead,
2019-10-13 17:43:42 +02:00
ResourceSearch,
2019-09-28 13:38:08 +02:00
ResourceCreate,
ResourceUpdateAll,
2019-09-29 19:19:38 +02:00
ResourceUpdate,
ResourceDeleteAll,
ResourceDelete
2019-09-26 17:24:40 +02:00
};
mod result;
2019-10-05 14:50:05 +02:00
pub use result::{
NoContent,
ResourceResult,
Success
};
2019-09-26 17:24:40 +02:00
mod routing;
2019-09-26 17:42:28 +02:00
pub use routing::{DrawResources, DrawResourceRoutes};
2019-09-30 18:18:10 +02:00
#[cfg(feature = "openapi")]
pub use routing::WithOpenapi;
2019-09-30 20:58:15 +02:00
/// A type that can be used inside a request or response body. Implemented for every type
/// that is serializable with serde, however, it is recommended to use the rest_struct!
/// macro to create one.
#[cfg(not(feature = "openapi"))]
2019-10-01 00:49:13 +02:00
pub trait ResourceType : DeserializeOwned + Serialize
2019-09-30 20:58:15 +02:00
{
}
#[cfg(not(feature = "openapi"))]
2019-10-01 00:49:13 +02:00
impl<T : DeserializeOwned + Serialize> ResourceType for T
2019-09-30 20:58:15 +02:00
{
}
/// A type that can be used inside a request or response body. Implemented for every type
/// that is serializable with serde, however, it is recommended to use the rest_struct!
/// macro to create one.
#[cfg(feature = "openapi")]
2019-10-01 00:49:13 +02:00
pub trait ResourceType : OpenapiType + DeserializeOwned + Serialize
2019-09-30 20:58:15 +02:00
{
}
#[cfg(feature = "openapi")]
2019-10-01 00:49:13 +02:00
impl<T : OpenapiType + DeserializeOwned + Serialize> ResourceType for T
2019-09-30 20:58:15 +02:00
{
}