Skip to content

Commit

Permalink
Add is_account_empty as experimental method
Browse files Browse the repository at this point in the history
Mv isAccountEmpty to experimental namespace

Add experimental as a cargo feature

Make experimental native methods private
  • Loading branch information
s1na authored and axic committed May 28, 2019
1 parent da8faef commit 64ec5a7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/experimental.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//! Experimental methods.

use super::*;

mod native {
extern "C" {
pub fn experimental_isAccountEmpty(addressOffset: *const u32) -> u32;
}
}

pub fn is_account_empty(address: &Address) -> bool {
let ret = unsafe { native::experimental_isAccountEmpty(address.bytes.as_ptr() as *const u32) };
if ret != 0 && ret != 1 {
panic!();
}

ret == 1
}
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ pub mod bignum;
#[cfg(not(feature = "std"))]
pub mod convert;

#[cfg(feature = "experimental")]
pub mod experimental;

#[cfg(feature = "std")]
use std::vec::Vec;

Expand Down

0 comments on commit 64ec5a7

Please sign in to comment.