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
29mod arg_list;
30mod as_dependency;
31mod blake2b;
32mod chain_extension;
33mod contract;
34mod dispatch;
35mod env;
36mod event;
37mod ink_test;
38mod item_impls;
39mod metadata;
40mod selector;
41mod solidity;
42mod storage;
43mod storage_item;
44mod trait_def;
45
46pub use self::{
47    arg_list::{
48        generate_argument_list,
49        generate_reference_to_trait_info,
50        input_bindings,
51        input_bindings_tuple,
52        input_message_idents,
53        input_types,
54        input_types_tuple,
55        output_ident,
56    },
57    as_dependency::ContractReference,
58    blake2b::Blake2x256,
59    chain_extension::ChainExtension,
60    contract::Contract,
61    dispatch::Dispatch,
62    env::Env,
63    event::Event,
64    ink_test::InkTest,
65    item_impls::ItemImpls,
66    metadata::{
67        generate_type_spec,
68        Metadata,
69    },
70    selector::{
71        SelectorBytes,
72        SelectorId,
73    },
74    storage::Storage,
75    storage_item::StorageItem,
76    trait_def::TraitDefinition,
77};