ink_codegen/generator/
mod.rs

1// Copyright (C) Use Ink (UK) Ltd.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15/// Implements `AsRef` for a code generator type.
16///
17/// Code generators always have a shared `contract` reference to the contract.
18/// They need to implement this trait in order to use other code generators.
19macro_rules! impl_as_ref_for_generator {
20    ( $generator_name:ident ) => {
21        impl ::core::convert::AsRef<ir::Contract> for $generator_name<'_> {
22            fn as_ref(&self) -> &ir::Contract {
23                self.contract
24            }
25        }
26    };
27}
28
29#[macro_use]
30mod macros;
31
32mod arg_list;
33mod as_dependency;
34mod blake2b;
35mod contract;
36mod dispatch;
37mod env;
38mod event;
39mod ink_test;
40mod item_impls;
41mod metadata;
42mod selector;
43mod sol;
44mod storage;
45mod storage_item;
46mod trait_def;
47
48#[cfg(any(ink_abi = "sol", ink_abi = "all"))]
49pub use self::sol::metadata::SolidityMetadata;
50pub use self::{
51    arg_list::{
52        generate_argument_list,
53        generate_reference_to_trait_info,
54        input_bindings,
55        input_bindings_tuple,
56        input_message_idents,
57        input_types,
58        input_types_tuple,
59        output_ident,
60    },
61    as_dependency::ContractReference,
62    blake2b::Blake2x256,
63    contract::Contract,
64    dispatch::Dispatch,
65    env::Env,
66    event::Event,
67    ink_test::InkTest,
68    item_impls::ItemImpls,
69    metadata::{
70        Metadata,
71        generate_type_spec,
72    },
73    selector::{
74        SelectorBytes,
75        SelectorId,
76    },
77    storage::Storage,
78    storage_item::StorageItem,
79    trait_def::TraitDefinition,
80};