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 chain_extension;
36mod contract;
37mod dispatch;
38mod env;
39mod event;
40mod ink_test;
41mod item_impls;
42mod metadata;
43mod selector;
44mod sol;
45mod storage;
46mod storage_item;
47mod trait_def;
48
49#[cfg(any(ink_abi = "sol", ink_abi = "all"))]
50pub use self::sol::metadata::SolidityMetadata;
51pub use self::{
52    arg_list::{
53        generate_argument_list,
54        generate_reference_to_trait_info,
55        input_bindings,
56        input_bindings_tuple,
57        input_message_idents,
58        input_types,
59        input_types_tuple,
60        output_ident,
61    },
62    as_dependency::ContractReference,
63    blake2b::Blake2x256,
64    chain_extension::ChainExtension,
65    contract::Contract,
66    dispatch::Dispatch,
67    env::Env,
68    event::Event,
69    ink_test::InkTest,
70    item_impls::ItemImpls,
71    metadata::{
72        generate_type_spec,
73        Metadata,
74    },
75    selector::{
76        SelectorBytes,
77        SelectorId,
78    },
79    storage::Storage,
80    storage_item::StorageItem,
81    trait_def::TraitDefinition,
82};