etopay_sdk/
lib.rs

1#![warn(missing_docs)]
2#![doc = include_str!("../README.md")]
3
4// pub modules accessible by bindings
5pub mod core;
6pub mod types;
7
8// expose error and result types in the crate root
9pub mod error;
10pub use error::{Error, Result};
11
12// internal modules
13mod backend;
14mod user;
15mod wallet;
16pub use wallet::error::{ErrorKind, WalletError};
17
18#[cfg(not(target_arch = "wasm32"))]
19mod logger;
20
21pub use wallet::*;
22
23/// mod used for sdk unit-test utilities
24#[cfg(test)]
25pub(crate) mod testing_utils;
26
27/// Exported secrecy crate to use in the bindings
28pub use secrecy;
29
30/// Helper macro for bindings to return an error if the feature is not enabled.
31/// Produces an Err(String) variant if the feature is not enabled, and the value of the
32/// body if the feature is enabled.
33#[macro_export]
34macro_rules! require_feature {
35    // this arm adds a default String error message
36    ($feature: literal, $body: block) => {{
37        $crate::require_feature!(
38            $feature,
39            $body,
40            format!("SDK is not compiled with feature `{}` enabled", $feature)
41        )
42    }};
43    // this one allows specifying the error value manually
44    ($feature: literal, $body: block, $error: expr) => {{
45        #[cfg(not(feature = $feature))]
46        {
47            Err($error)
48        }
49
50        #[cfg(feature = $feature)]
51        $body
52    }};
53}
54
55use shadow_rs::shadow;
56shadow!(build);