-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add is_account_empty as experimental method
Mv isAccountEmpty to experimental namespace Add experimental as a cargo feature Make experimental native methods private
- Loading branch information
Showing
3 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ wee_alloc = "0.4.4" | |
default = [ "std" ] | ||
std = [] | ||
debug = [] | ||
experimental = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters