radix_engine_interface/
lib.rs

1#![cfg_attr(not(feature = "std"), no_std)]
2#![recursion_limit = "256"] // Enables certain tests of deep typed SBOR to function
3
4#[cfg(not(any(feature = "std", feature = "alloc")))]
5compile_error!("Either feature `std` or `alloc` must be enabled for this crate.");
6#[cfg(all(feature = "std", feature = "alloc"))]
7compile_error!("Feature `std` and `alloc` can't be enabled at the same time.");
8
9// TODO: eventually only `api` (System API) should stay in this crate.
10
11pub mod api;
12pub mod blueprints;
13pub mod macros;
14pub mod object_modules;
15pub mod types;
16
17// extern crate self as X; in lib.rs allows ::X and X to resolve to this crate inside this crate.
18// This enables procedural macros which output code involving paths to this crate, to work inside
19// this crate. See this link for details:
20// https://users.rust-lang.org/t/how-can-i-use-my-derive-macro-from-the-crate-that-declares-the-trait/60502
21//
22// IMPORTANT:
23// This should never be pub, else `X::X::X::X::...` becomes a valid path in downstream crates,
24// which we've discovered can cause really bad autocomplete times (when combined with other
25// specific imports, generic traits, resolution paths which likely trigger edge cases in
26// Rust Analyzer which get stuck on these infinite possible paths)
27extern crate self as radix_engine_interface;
28
29/// Each module should have its own prelude, which:
30/// * Adds preludes of upstream crates
31/// * Exports types with specific-enough names which mean they can safely be used downstream.
32///
33/// The idea is that we can just include the current crate's prelude and avoid messing around with tons of includes.
34/// This makes refactors easier, and makes integration into the node less painful.
35pub mod prelude {
36    pub use radix_common_derive::{dec, pdec};
37
38    // Exports from this crate
39    pub use crate::api::actor_api::*;
40    pub use crate::api::field_api::*;
41    pub use crate::api::key_value_entry_api::*;
42    pub use crate::api::key_value_store_api::*;
43    pub use crate::api::*;
44    pub use crate::blueprints::consensus_manager::*;
45    pub use crate::blueprints::locker::*;
46    pub use crate::blueprints::resource::*;
47    pub use crate::blueprints::utils::*;
48    pub use crate::object_modules::metadata::*;
49    pub use crate::object_modules::role_assignment::*;
50    pub use crate::object_modules::royalty::*;
51    pub use crate::object_modules::ModuleConfig;
52    pub use crate::types::*;
53    pub use crate::{
54        access_and_or, burn_roles, composite_requirement, deposit_roles, freeze_roles,
55        internal_roles, metadata, metadata_init, metadata_init_set_entry, metadata_roles,
56        mint_roles, non_fungible_data_update_roles, recall_roles, role_entry, roles2, rule,
57        withdraw_roles,
58    };
59}
60
61pub(crate) mod internal_prelude {
62    pub use crate::prelude::*;
63    pub use radix_common::prelude::*;
64}