1#[macro_use]
38mod macros;
39
40mod attrs;
41mod chain_extension;
42mod constructor;
43mod contract;
44mod contract_ref;
45mod error;
46mod event;
47mod event_v2;
48mod extension;
49mod file;
50mod function;
51mod ink_e2e_test;
52mod ink_impl;
53mod ink_test;
54mod message;
55mod scale_derive;
56mod storage;
57mod storage_item;
58mod topic;
59mod trait_definition;
60
61mod environment;
62mod selector;
63
64mod iter;
65mod traits;
66mod tree;
67
68mod test_utils;
69
70pub use self::{
71 attrs::{
72 meta, InkArg, InkArgKind, InkArgValueKind, InkArgValuePathKind, InkArgValueStringKind,
73 InkAttribute, InkAttributeKind, InkMacroKind,
74 },
75 chain_extension::ChainExtension,
76 constructor::Constructor,
77 contract::Contract,
78 contract_ref::ContractRef,
79 environment::{EnvArg, Environment},
80 error::Error,
81 event::Event,
82 event_v2::EventV2,
83 extension::Extension,
84 file::InkFile,
85 function::Function,
86 ink_e2e_test::InkE2ETest,
87 ink_impl::InkImpl,
88 ink_test::InkTest,
89 message::Message,
90 scale_derive::ScaleDerive,
91 selector::{Selector, SelectorArg, SelectorArgKind},
92 storage::Storage,
93 storage_item::StorageItem,
94 topic::Topic,
95 trait_definition::TraitDefinition,
96 traits::{
97 HasInkEnvironment, HasInkImplParent, InkEntity, IsChainExtensionFn, IsInkCallable,
98 IsInkEvent, IsInkFn, IsInkStruct, IsInkTrait, IsIntId, IsSyntax,
99 },
100 tree::ast_ext::{
101 closest_ancestor_ast_type, closest_item_which, closest_non_trivia_token, parent_ast_item,
102 path_from_str, path_from_type, path_to_string, resolve_current_module, resolve_item,
103 resolve_qualifier, simple_use_paths_and_aliases_in_scope,
104 },
105 tree::utils::{
106 attrs, ink_ancestors, ink_arg_by_kind, ink_args, ink_args_by_kind, ink_attr_to_entity,
107 ink_attrs, ink_attrs_ancestors, ink_attrs_closest_ancestors, ink_attrs_closest_descendants,
108 ink_attrs_descendants, ink_attrs_in_scope, ink_callable_closest_descendants,
109 ink_closest_ancestors, ink_closest_descendants, ink_descendants,
110 ink_impl_closest_descendants, ink_parent, ink_peekable_quasi_closest_descendants,
111 },
112 tree::{InkTree, ItemAtOffset},
113};
114
115pub use ra_ap_syntax as syntax;
117
118pub use ra_ap_syntax::ast;
120
121#[derive(Debug, Clone, Copy, PartialEq, Eq)]
123#[non_exhaustive]
124pub enum Version {
125 Legacy,
128 V5(MinorVersion),
130 V6,
132}
133
134#[derive(Debug, Clone, Copy, PartialEq, Eq)]
136#[non_exhaustive]
137pub enum MinorVersion {
138 Latest,
140 Base,
142}
143
144impl Version {
145 pub fn is_legacy(&self) -> bool {
147 *self == Version::Legacy
148 }
149
150 pub fn is_v5(&self) -> bool {
152 matches!(self, Version::V5(..))
153 }
154
155 pub fn is_v6(&self) -> bool {
157 *self == Version::V6
158 }
159
160 pub fn is_lte_v5(&self) -> bool {
162 matches!(self, Version::Legacy | Version::V5(..))
163 }
164
165 pub fn is_gte_v5(&self) -> bool {
167 matches!(self, Version::V5(..) | Version::V6)
168 }
169
170 pub fn is_v5_0(&self) -> bool {
172 *self == Version::V5(MinorVersion::Base)
173 }
174
175 pub fn is_gte_v5_1(&self) -> bool {
177 matches!(self, Version::V5(MinorVersion::Latest) | Version::V6)
178 }
179
180 pub fn is_gte_v6(&self) -> bool {
182 self.is_v6()
183 }
184}