1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(not(any(feature = "std", feature = "alloc")))]
compile_error!("Either feature `std` or `alloc` must be enabled for this crate.");
#[cfg(all(feature = "std", feature = "alloc"))]
compile_error!("Feature `std` and `alloc` can't be enabled at the same time.");
/// SBOR basic, no custom types
pub mod basic;
/// SBOR Categorize trait
pub mod categorize;
/// SBOR codec for core Rust types.
pub mod codec;
/// SBOR constants
pub mod constants;
/// SBOR decode trait.
pub mod decode;
/// SBOR decoding.
pub mod decoder;
/// SBOR encode trait.
pub mod encode;
/// SBOR payload wrappers.
/// These are new types around an encoded payload or sub-payload, with helper methods / traits implemented.
/// They can be used as a more efficient wrapper a ScryptoValue if the content of that value is not needed.
pub mod encoded_wrappers;
/// SBOR encoding.
pub mod encoder;
mod enum_variant;
/// SBOR paths.
pub mod path;
/// SBOR payload validation.
pub mod payload_validation;
/// SBOR textual representations
pub mod representations;
/// A facade of Rust types.
pub mod rust;
/// SBOR Schema
pub mod schema;
/// SBOR structured payload traversal.
pub mod traversal;
/// SBOR value model and any decoding/encoding.
pub mod value;
/// SBOR value kinds - ie the types of value that are supported.
pub mod value_kind;
/// Data model versioning helper macro
pub mod versioned;
pub use basic::*;
pub(crate) use categorize::{categorize_generic, categorize_simple};
pub use categorize::{Categorize, SborEnum, SborTuple};
pub use constants::*;
pub use decode::Decode;
pub use decoder::{BorrowingDecoder, DecodeError, Decoder, VecDecoder};
pub use encode::Encode;
pub use encoder::{EncodeError, Encoder, VecEncoder};
pub use path::{SborPath, SborPathBuf};
pub use encoded_wrappers::*;
pub use enum_variant::*;
pub use payload_validation::*;
pub use schema::*;
pub use value::*;
pub use value_kind::*;
pub use versioned::*;
// Re-export derives
extern crate sbor_derive;
pub use sbor_derive::{
BasicCategorize, BasicDecode, BasicDescribe, BasicEncode, BasicSbor, Categorize, Decode,
Describe, Encode, Sbor,
};
// extern crate self as X; in lib.rs allows ::X and X to resolve to this crate inside this crate.
// This enables procedural macros which output code involving paths to this crate, to work inside
// this crate. See this link for details:
// https://users.rust-lang.org/t/how-can-i-use-my-derive-macro-from-the-crate-that-declares-the-trait/60502
//
// IMPORTANT:
// This should never be pub, else `X::X::X::X::...` becomes a valid path in downstream crates,
// which we've discovered can cause really bad autocomplete times (when combined with other
// specific imports, generic traits, resolution paths which likely trigger edge cases in
// Rust Analyzer which get stuck on these infinite possible paths)
extern crate self as sbor;
// For self-contained macros
pub extern crate paste;
/// Each module should have its own prelude, which:
/// * Adds preludes of upstream crates
/// * Exports types with specific-enough names which mean they can safely be used downstream.
///
/// The idea is that we can just include the current crate's prelude and avoid messing around with tons of includes.
/// This makes refactors easier, and makes integration into the node less painful.
///
/// Feel free to add more types to the prelude
pub mod prelude {
// Upstream preludes
pub use utils::prelude::*;
// Exports from current crate
pub use crate::encoded_wrappers::{RawPayload as SborRawPayload, RawValue as SborRawValue};
pub use crate::enum_variant::FixedEnumVariant as SborFixedEnumVariant;
pub use crate::path::{SborPath, SborPathBuf};
pub use crate::representations;
pub use crate::schema::prelude::*;
pub use crate::value::{CustomValue as SborCustomValue, Value as SborValue};
pub use crate::value_kind::*;
pub use crate::versioned::{CloneIntoLatest, HasLatestVersion, UpdateResult};
pub use crate::{
basic_decode, basic_encode, BasicCategorize, BasicDecode, BasicDescribe, BasicEncode,
BasicSbor,
};
pub use crate::{Categorize, Decode, Encode, Sbor, SborEnum, SborTuple};
pub use crate::{DecodeError, EncodeError};
}