fuel_derive/
lib.rs

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
//! Derive macros for canonical type serialization and deserialization.

#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![deny(unused_must_use, unsafe_code, unused_crate_dependencies, missing_docs)]
#![deny(
    clippy::arithmetic_side_effects,
    clippy::cast_sign_loss,
    clippy::cast_possible_truncation,
    clippy::cast_possible_wrap,
    clippy::string_slice
)]

mod helpers;

extern crate proc_macro;

mod canonical {
    mod attribute;
    pub mod deserialize;
    pub mod serialize;
}

synstructure::decl_derive!(
    [Serialize, attributes(canonical)] =>
    /// Derives `Serialize` trait for the given `struct` or `enum`.
    canonical::serialize::derive
);
synstructure::decl_derive!(
    [Deserialize, attributes(canonical)] =>
    /// Derives `Deserialize` trait for the given `struct` or `enum`.
    canonical::deserialize::derive
);

mod compression {
    mod attribute;
    pub mod compress;
    pub mod decompress;
}

synstructure::decl_derive!(
    [Compress, attributes(compress)] =>
    /// Derives `Compressible` and `CompressibleBy` traits for the given `struct` or `enum`.
    compression::compress::derive
);
synstructure::decl_derive!(
    [Decompress, attributes(compress)] =>
    /// Derives `DecompressibleBy` trait for the given `struct` or `enum`.
    compression::decompress::derive
);