core_crypto_ffi/lib.rs
1// Wire
2// Copyright (C) 2022 Wire Swiss GmbH
3
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see http://www.gnu.org/licenses/.
16
17#[macro_export]
18macro_rules! proteus_impl {
19 ($body:block or throw $err_type:ty) => {
20 {
21 cfg_if::cfg_if! {
22 if #[cfg(feature = "proteus")] {
23 #[allow(clippy::redundant_closure_call)]
24 $body
25 } else {
26 return <$err_type>::Err(core_crypto::Error::FeatureDisabled("proteus").into());
27 }
28 }
29 }
30 };
31 ($body:block) => {
32 proteus_impl!($body or throw ::std::result::Result<_, _>)
33 };
34}
35
36cfg_if::cfg_if! {
37 if #[cfg(target_family = "wasm")] {
38 mod wasm;
39 pub use self::wasm::*;
40 } else {
41 uniffi::setup_scaffolding!("core_crypto_ffi");
42
43 mod generic;
44 pub use self::generic::*;
45 }
46}
47
48#[cfg(doc)]
49pub mod bindings;