73 lines
2.1 KiB
Rust
Raw Normal View History

2019-10-07 14:01:20 +03:00
/*
* Copyright 2018 Fluence Labs Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
2020-07-01 00:50:56 +03:00
//! The main part of Fluence backend SDK. Contains `export_allocator`, `logger` and `result`
2019-10-07 14:01:20 +03:00
//! modules.
2020-07-01 00:50:56 +03:00
#![allow(clippy::missing_safety_doc)]
#![allow(clippy::needless_doctest_main)]
2021-03-01 14:43:33 +03:00
#![doc(html_root_url = "https://docs.rs/fluence-sdk-main/0.5.0")]
2019-10-07 14:01:20 +03:00
#![deny(
dead_code,
nonstandard_style,
unused_imports,
unused_mut,
unused_variables,
unused_unsafe,
unreachable_patterns
)]
#![warn(rust_2018_idioms)]
2019-10-07 14:01:20 +03:00
2020-07-01 00:50:56 +03:00
mod export_allocator;
#[cfg(any(feature = "debug", feature = "logger"))]
2020-07-01 00:50:56 +03:00
mod logger;
2021-03-11 13:58:29 +03:00
mod module_manifest;
2020-07-01 00:50:56 +03:00
mod result;
2021-03-11 19:01:16 +03:00
mod sdk_version_embedder;
2019-10-07 14:01:20 +03:00
2020-07-01 00:50:56 +03:00
pub use export_allocator::allocate;
2020-10-29 14:10:50 +03:00
2020-07-14 19:01:17 +03:00
#[cfg(feature = "logger")]
2020-12-07 16:30:03 +03:00
pub use logger::WasmLoggerBuilder;
2020-10-29 14:10:50 +03:00
#[cfg(feature = "logger")]
pub use logger::TargetMap;
2020-12-09 11:34:39 +03:00
#[cfg(feature = "logger")]
pub use logger::WASM_LOG_ENV_NAME;
2020-10-29 14:10:50 +03:00
2020-07-01 00:50:56 +03:00
pub use result::get_result_ptr;
pub use result::get_result_size;
pub use result::set_result_ptr;
pub use result::set_result_size;
pub use result::release_objects;
pub use result::add_object_to_release;
2020-07-08 12:38:56 +03:00
2021-03-11 19:01:16 +03:00
pub use module_manifest::MANIFEST_SECTION_NAME;
pub use sdk_version_embedder::VERSION_SECTION_NAME;
2021-04-22 17:45:06 +03:00
// these logs will be printed only if debug feature is enabled
#[macro_export]
macro_rules! debug_log {
($msg_generator:expr) => {
#[cfg(feature = "debug")]
{
let level = log::Level::Info as i32;
let target = 0i32;
let msg = $msg_generator;
2021-04-22 17:57:47 +03:00
crate::logger::log_utf8_string(level, target, msg.as_ptr() as i32, msg.len() as i32);
2021-04-22 17:45:06 +03:00
}
};
2020-07-08 12:38:56 +03:00
}