mirror of https://github.com/status-im/evmc.git
rust: add type aliases for certain ffi types
This commit is contained in:
parent
48f1903d9c
commit
c9ce3a10d4
|
@ -9,9 +9,11 @@
|
||||||
//! This crate documents how to use certain data types.
|
//! This crate documents how to use certain data types.
|
||||||
|
|
||||||
mod container;
|
mod container;
|
||||||
|
mod types;
|
||||||
|
|
||||||
pub use container::EvmcContainer;
|
pub use container::EvmcContainer;
|
||||||
pub use evmc_sys as ffi;
|
pub use evmc_sys as ffi;
|
||||||
|
pub use types::*;
|
||||||
|
|
||||||
pub trait EvmcVm {
|
pub trait EvmcVm {
|
||||||
fn init() -> Self;
|
fn init() -> Self;
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
use evmc_sys as ffi;
|
||||||
|
|
||||||
|
/// EVMC address
|
||||||
|
pub type Address = ffi::evmc_address;
|
||||||
|
|
||||||
|
/// EVMC 32 bytes value (used for hashes)
|
||||||
|
pub type Bytes32 = ffi::evmc_bytes32;
|
||||||
|
|
||||||
|
/// EVMC big-endian 256-bit integer
|
||||||
|
pub type Uint256 = ffi::evmc_uint256be;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
// These tests check for Default, PartialEq and Clone traits.
|
||||||
|
#[test]
|
||||||
|
fn address_smoke_test() {
|
||||||
|
let a = ffi::evmc_address::default();
|
||||||
|
let b = Address::default();
|
||||||
|
assert_eq!(a.clone(), b.clone());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn bytes32_smoke_test() {
|
||||||
|
let a = ffi::evmc_bytes32::default();
|
||||||
|
let b = Bytes32::default();
|
||||||
|
assert_eq!(a.clone(), b.clone());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn uint26be_smoke_test() {
|
||||||
|
let a = ffi::evmc_uint256be::default();
|
||||||
|
let b = Uint256::default();
|
||||||
|
assert_eq!(a.clone(), b.clone());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue