mod.rs 1.56 KB
Newer Older
1
// Copyright 2018-2021 Parity Technologies (UK) Ltd.
2
3
4
5
6
7
8
9
10
11
12
13
14
//
// 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.

15
16
17
18
19
20
21
22
23
24
25
26
27
28
/// Implements `AsRef` for a code generator type.
///
/// Code generators always have a shared `contract` reference to the contract.
/// They need to implement this trait in order to use other code generators.
macro_rules! impl_as_ref_for_generator {
    ( $generator_name:ident ) => {
        impl ::core::convert::AsRef<ir::Contract> for $generator_name<'_> {
            fn as_ref(&self) -> &ir::Contract {
                self.contract
            }
        }
    };
}

29
mod chain_extension;
30
31
32
33
34
mod contract;
mod cross_calling;
mod dispatch;
mod env;
mod events;
35
mod ink_test;
36
37
38
39
40
41
mod item_impls;
mod metadata;
mod storage;
mod trait_def;

pub use self::{
42
    chain_extension::ChainExtension,
43
44
45
46
47
48
49
50
    contract::Contract,
    cross_calling::{
        CrossCalling,
        CrossCallingConflictCfg,
    },
    dispatch::Dispatch,
    env::Env,
    events::Events,
51
    ink_test::InkTest,
52
53
54
55
56
    item_impls::ItemImpls,
    metadata::Metadata,
    storage::Storage,
    trait_def::TraitDefinition,
};