fluence_sdk_wit/token_stream_generator.rs
1/*
2 * Copyright 2020 Fluence Labs Limited
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17mod fn_generator;
18mod foreign_mod_generator;
19mod record_generator;
20
21use crate::ast_types::FCEAst;
22
23pub const GENERATED_WRAPPER_FUNC_PREFIX: &str = "__fce_generated_wrapper_func_";
24pub const GENERATED_SECTION_PREFIX: &str = "__fce_generated_section__";
25pub const GENERATED_GLOBAL_PREFIX: &str = "__fce_generated_static_global_";
26
27impl quote::ToTokens for FCEAst {
28 fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) {
29 match self {
30 FCEAst::Function(ast_function) => ast_function.to_tokens(tokens),
31 FCEAst::ExternMod(ast_extern) => ast_extern.to_tokens(tokens),
32 FCEAst::Record(ast_record) => ast_record.to_tokens(tokens),
33 }
34 }
35}