Files
base64
bitflags
bytes
cfg_if
dtoa
encoding_rs
fnv
foreign_types
foreign_types_shared
futures
futures_channel
futures_core
futures_executor
futures_io
futures_macro
futures_sink
futures_task
futures_util
async_await
future
io
lock
sink
stream
task
goauth
h2
hashbrown
http
http_body
httparse
hyper
hyper_tls
idna
indexmap
iovec
itoa
lazy_static
libc
log
matches
memchr
mime
mime_guess
mio
native_tls
net2
num_cpus
once_cell
openssl
openssl_probe
openssl_sys
percent_encoding
pin_project
pin_project_internal
pin_project_lite
pin_utils
proc_macro2
proc_macro_hack
proc_macro_nested
quote
reqwest
ryu
serde
serde_derive
serde_json
serde_urlencoded
simpl
slab
smpl_jwt
socket2
standback
syn
time
time_macros
time_macros_impl
tinyvec
tokio
future
io
loom
macros
net
park
runtime
stream
sync
task
time
util
tokio_tls
tokio_util
tower_service
tracing
tracing_core
try_lock
unicase
unicode_bidi
unicode_normalization
unicode_xid
url
want
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#![forbid(unsafe_code)]
#![deny(
    anonymous_parameters,
    rust_2018_idioms,
    trivial_casts,
    trivial_numeric_casts,
    unreachable_pub,
    const_err,
    illegal_floating_point_literal_pattern,
    late_bound_lifetime_arguments,
    path_statements,
    patterns_in_fns_without_body,
    clippy::all
)]
#![warn(
    unused_extern_crates,
    missing_copy_implementations,
    missing_debug_implementations,
    single_use_lifetimes,
    unused_qualifications,
    variant_size_differences,
    clippy::pedantic,
    clippy::nursery,
    clippy::decimal_literal_representation,
    clippy::get_unwrap,
    clippy::option_unwrap_used,
    clippy::print_stdout,
    clippy::result_unwrap_used
)]
#![allow(
    clippy::inline_always,
    clippy::cast_possible_wrap,
    clippy::cast_lossless,
    clippy::module_name_repetitions,
    clippy::must_use_candidate,
    clippy::use_self, // Not supported in some situations in older compilers.
)]

// This is required on rustc < 1.42.0.
#[allow(unused_extern_crates)]
extern crate proc_macro;

macro_rules! error {
    ($message:literal) => {
        error!(::proc_macro2::Span::call_site(), $message)
    };

    ($span:expr, $message:literal) => {
        Err(::syn::Error::new($span, $message))
    };

    ($span:expr, $($args:expr),+) => {
        Err(::syn::Error::new($span, format!($($args),+)))
    };
}

mod kw {
    use syn::custom_keyword;
    custom_keyword!(am);
    custom_keyword!(pm);
    custom_keyword!(AM);
    custom_keyword!(PM);
    custom_keyword!(utc);
    custom_keyword!(UTC);
}

mod date;
mod ext;
mod offset;
mod time;
mod time_crate;

use date::Date;
use offset::Offset;
use proc_macro_hack::proc_macro_hack;
use quote::ToTokens;
use syn::parse_macro_input;
use time::Time;

macro_rules! impl_macros {
    ($($name:ident : $type:ty),* $(,)?) => {
        $(
            #[proc_macro_hack]
            pub fn $name(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
                parse_macro_input!(input as $type).to_token_stream().into()
            }
        )*
    };
}

impl_macros! {
    time: Time,
    offset: Offset,
    date: Date,
}