aranya_crypto_derive/
lib.rs

1//! A proc macro so the `crypto` crate can generate algorithm
2//! identifiers.
3
4#![allow(unstable_name_collisions)]
5#![cfg_attr(docsrs, feature(doc_cfg))]
6#![warn(missing_docs)]
7
8mod alg_id;
9
10use proc_macro::TokenStream;
11use syn::Error;
12
13// See the `crypto` crate for documentation.
14#[proc_macro_derive(AlgId, attributes(alg_id))]
15#[allow(missing_docs)]
16pub fn alg_id(item: TokenStream) -> TokenStream {
17    alg_id::parse(item.into())
18        .unwrap_or_else(Error::into_compile_error)
19        .into()
20}