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