get rid of excess exports for module

since https://github.com/rust-lang/rust/issues/63562 fixed
This commit is contained in:
vms 2020-04-29 00:15:05 +03:00
parent 3ae49e9a37
commit b89a9878d2
2 changed files with 4 additions and 13 deletions

View File

@ -136,12 +136,8 @@ impl Parse for HandlerAttr {
pub fn generate_side_modules_glue_code(side_modules_list: &[String]) -> syn::Result<TokenStream2> { pub fn generate_side_modules_glue_code(side_modules_list: &[String]) -> syn::Result<TokenStream2> {
let mut modules_glue_code = quote!(); let mut modules_glue_code = quote!();
for module_name in side_modules_list { for module_name in side_modules_list {
let allocate_fn_name = format!("{}_allocate", module_name);
let deallocate_fn_name = format!("{}_deallocate", module_name);
let invoke_fn_name = format!("{}_invoke", module_name);
let load_fn_name = format!("{}_load", module_name);
let store_fn_name = format!("{}_store", module_name);
let module_name_ident = syn::parse_str::<syn::Ident>(&module_name)?; let module_name_ident = syn::parse_str::<syn::Ident>(&module_name)?;
modules_glue_code = quote! { modules_glue_code = quote! {
@ -149,23 +145,18 @@ pub fn generate_side_modules_glue_code(side_modules_list: &[String]) -> syn::Res
#[link(wasm_import_module = #module_name)] #[link(wasm_import_module = #module_name)]
extern "C" { extern "C" {
// Allocate chunk of module memory, and return a pointer to that region // Allocate chunk of module memory, and return a pointer to that region
#[link_name = #allocate_fn_name]
pub fn allocate(size: usize) -> i32; pub fn allocate(size: usize) -> i32;
// Deallocate chunk of module memory after it's not used anymore // Deallocate chunk of module memory after it's not used anymore
#[link_name = #deallocate_fn_name]
pub fn deallocate(ptr: i32, size: usize); pub fn deallocate(ptr: i32, size: usize);
// Call module's invocation handler with data specified by pointer and size // Call module's invocation handler with data specified by pointer and size
#[link_name = #invoke_fn_name]
pub fn invoke(ptr: i32, size: usize) -> i32; pub fn invoke(ptr: i32, size: usize) -> i32;
// Read 1 byte from ptr location of module memory // Read 1 byte from ptr location of module memory
#[link_name = #load_fn_name]
pub fn load(ptr: i32) -> u8; pub fn load(ptr: i32) -> u8;
// Put 1 byte at ptr location in module memory // Put 1 byte at ptr location in module memory
#[link_name = #store_fn_name]
pub fn store(ptr: *mut i32, byte: u8); pub fn store(ptr: *mut i32, byte: u8);
} }

View File

@ -73,7 +73,7 @@
//! [`lazy_static::initialize()`]: https://docs.rs/lazy_static/1.3.0/lazy_static/fn.initialize.html //! [`lazy_static::initialize()`]: https://docs.rs/lazy_static/1.3.0/lazy_static/fn.initialize.html
//! [`backend app debugging`]: https://fluence.dev/docs/debugging //! [`backend app debugging`]: https://fluence.dev/docs/debugging
extern crate log; use log;
/// The Wasm Logger. /// The Wasm Logger.
/// ///
@ -137,12 +137,12 @@ impl WasmLogger {
impl log::Log for WasmLogger { impl log::Log for WasmLogger {
#[inline] #[inline]
fn enabled(&self, metadata: &log::Metadata) -> bool { fn enabled(&self, metadata: &log::Metadata<'_>) -> bool {
metadata.level() <= self.level metadata.level() <= self.level
} }
#[inline] #[inline]
fn log(&self, record: &log::Record) { fn log(&self, record: &log::Record<'_>) {
if !self.enabled(record.metadata()) { if !self.enabled(record.metadata()) {
return; return;
} }