mirror of
https://github.com/fluencelabs/marine-rs-sdk-test
synced 2024-12-04 23:30:18 +00:00
introduce internal mod to improve sdk API
This commit is contained in:
parent
d33872aa5e
commit
5dc680c046
@ -97,8 +97,8 @@ fn generate_epilog(ty: &Option<ParsedType>) -> proc_macro2::TokenStream {
|
||||
return result as _;
|
||||
},
|
||||
Some(ty) if ty.is_integral_type() => quote! {
|
||||
fluence::set_result_ptr(result.as_ptr() as _);
|
||||
fluence::set_result_size(result.len() as _);
|
||||
fluence::internal::set_result_ptr(result.as_ptr() as _);
|
||||
fluence::internal::set_result_size(result.len() as _);
|
||||
std::mem::forget(result);
|
||||
},
|
||||
_ => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018 Fluence Labs Limited
|
||||
* Copyright 2020 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.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018 Fluence Labs Limited
|
||||
* Copyright 2020 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.
|
||||
@ -46,16 +46,16 @@ impl ForeignModEpilogGlueCodeGenerator for Option<ParsedType> {
|
||||
},
|
||||
Some(ParsedType::Utf8String) => quote! {
|
||||
String::from_raw_parts(
|
||||
fluence::get_result_ptr() as _,
|
||||
fluence::get_result_size() as _,
|
||||
fluence::get_result_size() as _
|
||||
fluence::internal::get_result_ptr() as _,
|
||||
fluence::internal::get_result_size() as _,
|
||||
fluence::internal::get_result_size() as _
|
||||
)
|
||||
},
|
||||
Some(ParsedType::ByteVector) => quote! {
|
||||
Vec::from_raw_parts(
|
||||
fluence::get_result_ptr() as _,
|
||||
fluence::get_result_size() as _,
|
||||
fluence::get_result_size() as _
|
||||
fluence::internal::get_result_ptr() as _,
|
||||
fluence::internal::get_result_size() as _,
|
||||
fluence::internal::get_result_size() as _
|
||||
)
|
||||
},
|
||||
Some(ParsedType::Record(_)) => unimplemented!(),
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018 Fluence Labs Limited
|
||||
* Copyright 2020 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.
|
||||
|
16
src/lib.rs
16
src/lib.rs
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018 Fluence Labs Limited
|
||||
* Copyright 2020 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.
|
||||
@ -35,7 +35,13 @@ extern crate fluence_sdk_macro;
|
||||
extern crate fluence_sdk_main;
|
||||
|
||||
pub use fluence_sdk_macro::fce;
|
||||
pub use fluence_sdk_main::get_result_ptr;
|
||||
pub use fluence_sdk_main::get_result_size;
|
||||
pub use fluence_sdk_main::set_result_ptr;
|
||||
pub use fluence_sdk_main::set_result_size;
|
||||
pub use fluence_sdk_main::WasmLogger;
|
||||
|
||||
/// These API functions are intended for internal usage in generated code.
|
||||
/// Normally, you shouldn't use them.
|
||||
pub mod internal {
|
||||
pub use fluence_sdk_main::get_result_ptr;
|
||||
pub use fluence_sdk_main::get_result_size;
|
||||
pub use fluence_sdk_main::set_result_ptr;
|
||||
pub use fluence_sdk_main::set_result_size;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user