novax_data/
lib.rs

1//! `novax-data` is a crate designed to facilitate data handling and conversions in blockchain-based applications.
2//!
3//! This crate provides a robust set of types and utility functions to ease the conversion and management 
4//! of data structures when working with MultiversX virtual machine and the associated blockchain technology.
5//! It encompasses common patterns for data conversion and parsing, especially around address representations,
6//! and error handling.
7//!
8//! # Core Concepts
9//!
10//! - **Native and Managed Type Conversion**:
11//!   `NativeConvertible` and `ManagedConvertible` are traits provided to bridge the gap between complex smart contract types
12//!   managed by the MultiversX virtual machine and common Rust types. They facilitate seamless conversions back and forth,
13//!   supporting a variety of scenarios such as converting a `String` to a `ManagedBuffer` or `TokenIdentifier`.
14//!
15//! - **Address Handling**:
16//!   The `Address` struct along with its associated methods simplify the operations and transformations
17//!   required when dealing with address representations on the blockchain.
18//!
19//! - **Data Parsing and Error Handling**:
20//!   Utility functions like `parse_query_return_string_data` and `parse_query_return_bytes_data` are provided to
21//!   parse and decode data from blockchain queries. Comprehensive error types like `DataError`, `AddressError`, and
22//!   `UtilsError` centralize error handling, making error propagation and management straightforward.
23//!
24//! # Usage
25//!
26//! Most of the time, developers won't have to include `novax-data` directly as a dependency. Its primary purpose is
27//! to serve as a foundational utility crate used by other "novax" crates such as "novax", "novax-executor", "novax-token", etc.
28//! However, if direct usage is required:
29//!
30//! ```rust
31//! use novax_data::{Address, NativeConvertible, ManagedConvertible, parse_query_return_string_data, DataError};
32//!
33//! // ... your code here ...
34//! ```
35//!
36//! For detailed examples and usage of each type and utility function, refer to their respective module and function documentation.
37//!
38//! # Modules
39//! - `types`: Defines core types like `Address`, and the conversion traits `NativeConvertible` and `ManagedConvertible`.
40//! - `constants`: (Further details can be provided as needed)
41//! - `error`: Centralizes error definitions including `DataError`, `AddressError`, and `UtilsError` for robust error handling.
42//! - `utils`: Provides utility functions for data parsing and other common operations.
43//!
44//! For a deep dive into each module and to understand the various types, traits, and functions provided,
45//! navigate through the module documentation below.
46//!
47// TODO #![warn(missing_docs)]
48
49mod types;
50mod constants;
51mod error;
52mod utils;
53
54pub use error::*;
55pub use crate::types::native::NativeConvertible;
56pub use crate::types::managed::ManagedConvertible;
57pub use crate::types::address::Address;
58pub use crate::types::payment::Payment;
59pub use crate::utils::parse_query_return_data::parse_query_return_string_data;
60pub use crate::utils::parse_query_return_data::parse_query_return_bytes_data;