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
multiversx_sc::imports!();
multiversx_sc::derive_imports!();

/// Provides a bridge from a complex smart contract type, managed by the
/// MultiversX virtual machine, to a common Rust type.
///
/// This trait facilitates the conversion from managed types to native Rust types.
/// The conversion is one-way and is designed to map multiple managed types to
/// a single Rust type, establishing a many-to-one relationship.
///
/// Implementing this trait requires specifying the associated `Native` type
/// and providing an implementation for the `to_native` method, which will carry
/// out the actual conversion.
///
/// # Type Parameters
/// - `Native`: The native Rust type to which the managed type will be converted.
///
/// # Methods
/// - `to_native`: Performs the conversion from the managed type to the specified
/// native Rust type.
pub trait NativeConvertible {
    /// The native Rust type to which the managed type will be converted.
    type Native;

    /// Converts the managed type to the specified native Rust type.
    fn to_native(&self) -> Self::Native;
}