update to marine 0.6.2, remove unsafe

This commit is contained in:
boneyard93501
2021-04-29 20:16:57 -05:00
parent 1946f8f544
commit 9387249eef
9 changed files with 133 additions and 41 deletions

View File

@ -10,5 +10,5 @@ path = "src/main.rs"
name = "curl_adapter"
[dependencies]
fluence = { version = "=0.2.18", features = ["logger"]}
fluence = { version = "=0.6.2", features = ["logger"]}
log = "0.4.8"

View File

@ -13,25 +13,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#![allow(improper_ctypes)]
use fluence::fce;
use fluence::module_manifest;
use fluence::MountedBinaryResult;
use fluence::WasmLoggerBuilder;
/// Log level can be changed by `RUST_LOG` env as well.
pub fn main() {
module_manifest!();
fn main() {
WasmLoggerBuilder::new().build().unwrap();
}
#[fce]
pub fn curl_request(url: String) -> String {
// log::info!("get called with url {}", url);
unsafe { curl(url) }
pub fn curl_request(curl_cmd: Vec<String>) -> MountedBinaryResult {
let response = curl(curl_cmd);
response
}
/// Permissions in `Config.toml` should exist to use host functions.
// mounted_binaries are available to import like this:
#[fce]
#[link(wasm_import_module = "host")]
extern "C" {
fn curl(cmd: String) -> String;
pub fn curl(cmd: Vec<String>) -> MountedBinaryResult;
}