doku/objects/
document.rs

1use crate::*;
2
3/// A type that can be pretty-printed by Doku.
4///
5/// Usually you'll get this by adding `#[derive(Document)]` to your type:
6///
7/// ```
8/// use doku::Document;
9///
10/// #[derive(Document)]
11/// struct Foo;
12/// ```
13///
14/// ... but implementing it manually will be required if you're using a custom
15/// serializer / deserializer (see: the examples directory).
16pub trait Document {
17    fn ty() -> Type;
18}
19
20macro_rules! document {
21    (
22        $(
23            for $ty:ty
24            $(where ($($impl:tt)+) $({ $($where:tt)+ })?)?
25            => $expr:expr;
26        )+
27    ) => {
28        $(
29            impl $(< $($impl)+ >)? Document for $ty
30            $( $( where $($where)+ )? )?
31            {
32                fn ty() -> Type {
33                    $expr.into()
34                }
35            }
36        )+
37    };
38}
39
40mod lang;
41mod std;
42
43#[cfg(feature = "chrono-04")]
44mod chrono_04;
45
46#[cfg(feature = "url-2")]
47mod url_2;