marine-rs-sdk-test/crates/macro-test/src/lib.rs
2021-03-02 11:38:03 +03:00

44 lines
1.3 KiB
Rust

/*
* Copyright 2020 Fluence Labs Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#![doc(html_root_url = "https://docs.rs/fluence-sdk-macro/0.4.2")]
#![deny(
dead_code,
nonstandard_style,
unused_imports,
unused_mut,
unused_unsafe,
unreachable_patterns
)]
#![warn(rust_2018_idioms)]
#![recursion_limit = "1024"]
mod fce_test;
use proc_macro::TokenStream;
#[proc_macro_attribute]
pub fn fce_test(attr: TokenStream, input: TokenStream) -> TokenStream {
// into converts proc_macro::TokenStream to proc_macro2::TokenStream
match fce_impl(input.into()) {
Ok(v) => v,
// converts syn:error to proc_macro2::TokenStream
Err(e) => e.to_compile_error(),
}
// converts proc_macro2::TokenStream to proc_macro::TokenStream
.into()
}