graph_derive/
lib.rs

1// #![deny(missing_debug_implementations, missing_copy_implementations)]
2// #![warn(missing_docs, rustdoc::missing_crate_level_docs)]
3#![doc = include_str ! ("../readme.md")]
4#![doc(html_logo_url = "https://raw.githubusercontent.com/oovm/shape-rs/dev/projects/images/Trapezohedron.svg")]
5#![doc(html_favicon_url = "https://raw.githubusercontent.com/oovm/shape-rs/dev/projects/images/Trapezohedron.svg")]
6
7extern crate proc_macro;
8
9mod derive_graph;
10
11use crate::derive_graph::GraphDerive;
12
13use proc_macro::TokenStream;
14use quote::ToTokens;
15use syn::parse_macro_input;
16
17pub(crate) mod utils;
18
19/// Derive the `Graph` trait for a struct.
20#[proc_macro_derive(Graph, attributes(graph, easy_graph))]
21pub fn derive_graph(input: TokenStream) -> TokenStream {
22    let input = parse_macro_input!(input as GraphDerive);
23    TokenStream::from(ToTokens::to_token_stream(&input))
24}