ink_ir/lib.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//! The ink! intermediate representation (IR) and abstractions.
16//!
17//! This module defines everything the ink! procedural macro needs in order to
18//! parse, analyze and generate code for ink! smart contracts.
19//!
20//! The entry point for every ink! smart contract is the
21//! [`Contract`](`crate::ir::Contract`) with its [`Config`](`crate::ir::Config`) provided
22//! in the initial invocation at `#[ink::contract(... configuration ...)]`.
23//!
24//! The ink! IR tries to stay close to the original Rust syntactic structure.
25//! All ink! definitions of an ink! smart contract are always defined within
26//! a so-called Rust inline module (`mod my_module { ... items ... }`).
27//! Therefore all ink! definition are found and accessed using the
28//! [`ItemMod`](`crate::ir::ItemMod`) data structure.
29
30#![doc(
31 html_logo_url = "https://use.ink/img/crate-docs/logo.png",
32 html_favicon_url = "https://use.ink/crate-docs/favicon.png"
33)]
34
35#[macro_use]
36mod error;
37
38pub mod ast;
39mod ir;
40mod literal;
41
42pub use self::{
43 ir::{
44 blake2b_256,
45 marker,
46 utils,
47 Blake2x256Macro,
48 Callable,
49 CallableKind,
50 CallableWithSelector,
51 ChainExtension,
52 ChainExtensionMethod,
53 Config,
54 Constructor,
55 Contract,
56 Event,
57 EventConfig,
58 ExtensionId,
59 ImplItem,
60 InkItem,
61 InkItemTrait,
62 InkTest,
63 InkTraitDefinition,
64 InkTraitItem,
65 InkTraitMessage,
66 InputsIter,
67 IsDocAttribute,
68 Item,
69 ItemImpl,
70 ItemMod,
71 IterConstructors,
72 IterEvents,
73 IterInkTraitItems,
74 IterItemImpls,
75 IterMessages,
76 Message,
77 Namespace,
78 Receiver,
79 Selector,
80 SelectorMacro,
81 SignatureTopic,
82 Storage,
83 StorageItem,
84 Visibility,
85 },
86 literal::HexLiteral,
87};