#[macro_use]
mod macros;
mod attrs;
mod chain_extension;
mod constructor;
mod contract;
mod contract_ref;
mod error;
mod event;
mod event_v2;
mod extension;
mod file;
mod function;
mod ink_e2e_test;
mod ink_impl;
mod ink_test;
mod message;
mod scale_derive;
mod storage;
mod storage_item;
mod topic;
mod trait_definition;
mod environment;
mod selector;
mod iter;
mod traits;
mod tree;
mod test_utils;
pub use self::{
attrs::{
meta, InkArg, InkArgKind, InkArgValueKind, InkArgValuePathKind, InkArgValueStringKind,
InkAttribute, InkAttributeKind, InkMacroKind,
},
chain_extension::ChainExtension,
constructor::Constructor,
contract::Contract,
contract_ref::ContractRef,
environment::{EnvArg, Environment},
error::Error,
event::Event,
event_v2::EventV2,
extension::Extension,
file::InkFile,
function::Function,
ink_e2e_test::InkE2ETest,
ink_impl::InkImpl,
ink_test::InkTest,
message::Message,
scale_derive::ScaleDerive,
selector::{Selector, SelectorArg, SelectorArgKind},
storage::Storage,
storage_item::StorageItem,
topic::Topic,
trait_definition::TraitDefinition,
traits::{
HasInkEnvironment, HasInkImplParent, InkEntity, IsChainExtensionFn, IsInkCallable,
IsInkEvent, IsInkFn, IsInkStruct, IsInkTrait, IsIntId, IsSyntax,
},
tree::ast_ext::{
closest_ancestor_ast_type, closest_item_which, closest_non_trivia_token, parent_ast_item,
path_from_str, path_from_type, path_to_string, resolve_current_module, resolve_item,
resolve_qualifier, simple_use_paths_and_aliases_in_scope,
},
tree::utils::{
attrs, ink_ancestors, ink_arg_by_kind, ink_args, ink_args_by_kind, ink_attr_to_entity,
ink_attrs, ink_attrs_ancestors, ink_attrs_closest_ancestors, ink_attrs_closest_descendants,
ink_attrs_descendants, ink_attrs_in_scope, ink_callable_closest_descendants,
ink_closest_ancestors, ink_closest_descendants, ink_descendants,
ink_impl_closest_descendants, ink_parent, ink_peekable_quasi_closest_descendants,
},
tree::{InkTree, ItemAtOffset},
};
pub use ra_ap_syntax as syntax;
pub use ra_ap_syntax::ast;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum Version {
Legacy,
V5(MinorVersion),
V6,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum MinorVersion {
Latest,
Base,
}
impl Version {
pub fn is_legacy(&self) -> bool {
*self == Version::Legacy
}
pub fn is_v5(&self) -> bool {
matches!(self, Version::V5(..))
}
pub fn is_v6(&self) -> bool {
*self == Version::V6
}
pub fn is_lte_v5(&self) -> bool {
matches!(self, Version::Legacy | Version::V5(..))
}
pub fn is_gte_v5(&self) -> bool {
matches!(self, Version::V5(..) | Version::V6)
}
pub fn is_v5_0(&self) -> bool {
*self == Version::V5(MinorVersion::Base)
}
pub fn is_gte_v5_1(&self) -> bool {
matches!(self, Version::V5(MinorVersion::Latest) | Version::V6)
}
pub fn is_gte_v6(&self) -> bool {
self.is_v6()
}
}