byte_strings_proc_macro/
lib.rs1extern crate proc_macro;
2use ::quote;
3use ::syn::{
4 self,
5 spanned::Spanned,
6};
7
8#[cfg(not(feature = "proc-macro-hygiene"))]
9use ::syn::parse::Parse;
11
12macro_rules! throw {
13 ($span:expr => $message:expr) => (
14 return proc_macro::TokenStream::from(
15 quote::quote_spanned! {$span=>
16 compile_error!($message)
17 }
18 )
19 );
20
21 ($message:expr) => (
22 return proc_macro::TokenStream::from(
23 quote::quote! {
24 compile_error!($message)
25 }
26 )
27 );
28}
29
30mod kw {
31 ::syn::custom_keyword!{
32 concat_bytes
33 }
34 ::syn::custom_keyword!{
35 as_bytes
36 }
37 ::syn::custom_keyword!{
38 identity_non_null
39 }
40 ::syn::custom_keyword!{
41 c_str
42 }
43}
44
45type CommaExprs = syn::punctuated::Punctuated<syn::Expr, syn::Token![,]>;
46
47include!{
48 "concat_bytes.rs"
49}
50
51include!{
52 "as_bytes.rs"
53}
54
55include!{
56 "identity_non_null.rs"
57}
58
59include!{
60 "c_str.rs"
61}