introduce test-record crate in the record example

This commit is contained in:
vms 2020-07-28 17:08:26 +03:00
parent ea7219f477
commit f8a5bbdfd2
8 changed files with 63 additions and 39 deletions

19
Cargo.lock generated
View File

@ -318,6 +318,7 @@ name = "effector"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"fluence", "fluence",
"test-record",
] ]
[[package]] [[package]]
@ -441,7 +442,7 @@ dependencies = [
[[package]] [[package]]
name = "fluence" name = "fluence"
version = "0.2.0" version = "0.2.0"
source = "git+https://github.com/fluencelabs/rust-sdk#88afe8feaa6119ebeb2032281c26f6b74f2f8fd1" source = "git+https://github.com/fluencelabs/rust-sdk#4683526e16d6db8c93ce95dda724652dc657d35f"
dependencies = [ dependencies = [
"fluence-sdk-macro", "fluence-sdk-macro",
"fluence-sdk-main", "fluence-sdk-main",
@ -466,7 +467,7 @@ dependencies = [
[[package]] [[package]]
name = "fluence-sdk-macro" name = "fluence-sdk-macro"
version = "0.2.0" version = "0.2.0"
source = "git+https://github.com/fluencelabs/rust-sdk#88afe8feaa6119ebeb2032281c26f6b74f2f8fd1" source = "git+https://github.com/fluencelabs/rust-sdk#4683526e16d6db8c93ce95dda724652dc657d35f"
dependencies = [ dependencies = [
"fluence-sdk-wit", "fluence-sdk-wit",
] ]
@ -474,7 +475,7 @@ dependencies = [
[[package]] [[package]]
name = "fluence-sdk-main" name = "fluence-sdk-main"
version = "0.2.0" version = "0.2.0"
source = "git+https://github.com/fluencelabs/rust-sdk#88afe8feaa6119ebeb2032281c26f6b74f2f8fd1" source = "git+https://github.com/fluencelabs/rust-sdk#4683526e16d6db8c93ce95dda724652dc657d35f"
dependencies = [ dependencies = [
"log", "log",
] ]
@ -482,7 +483,7 @@ dependencies = [
[[package]] [[package]]
name = "fluence-sdk-wit" name = "fluence-sdk-wit"
version = "0.2.0" version = "0.2.0"
source = "git+https://github.com/fluencelabs/rust-sdk#88afe8feaa6119ebeb2032281c26f6b74f2f8fd1" source = "git+https://github.com/fluencelabs/rust-sdk#4683526e16d6db8c93ce95dda724652dc657d35f"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -874,6 +875,7 @@ name = "pure"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"fluence", "fluence",
"test-record",
] ]
[[package]] [[package]]
@ -1173,6 +1175,13 @@ dependencies = [
"winapi-util", "winapi-util",
] ]
[[package]]
name = "test-record"
version = "0.1.0"
dependencies = [
"fluence",
]
[[package]] [[package]]
name = "textwrap" name = "textwrap"
version = "0.11.0" version = "0.11.0"
@ -1414,7 +1423,7 @@ dependencies = [
[[package]] [[package]]
name = "wasmer-interface-types" name = "wasmer-interface-types"
version = "0.17.0" version = "0.17.0"
source = "git+https://github.com/fluencelabs/interface-types?branch=struct_support#eb3dbcb8353f658040621e179251b182695f04f4" source = "git+https://github.com/fluencelabs/interface-types?branch=struct_support#33ce6228c8ad668bdae6487c6df44c6b09763454"
dependencies = [ dependencies = [
"nom", "nom",
"safe-transmute", "safe-transmute",

View File

@ -12,6 +12,7 @@ members = [
"examples/records", "examples/records",
"examples/records/wasm/effector", "examples/records/wasm/effector",
"examples/records/wasm/pure", "examples/records/wasm/pure",
"examples/records/wasm/test-record",
"fluence-faas", "fluence-faas",
"tools/cli", "tools/cli",
] ]

View File

@ -10,3 +10,4 @@ path = "src/main.rs"
[dependencies] [dependencies]
fluence = { git = "https://github.com/fluencelabs/rust-sdk" } fluence = { git = "https://github.com/fluencelabs/rust-sdk" }
test-record = { path = "../test-record" }

View File

@ -15,26 +15,10 @@
*/ */
use fluence::fce; use fluence::fce;
use test_record::TestRecord;
pub fn main() {} pub fn main() {}
#[fce]
pub struct TestRecord {
pub field_0: bool,
pub field_1: i8,
pub field_2: i16,
pub field_3: i32,
pub field_4: i64,
pub field_5: u8,
pub field_6: u16,
pub field_7: u32,
pub field_8: u64,
pub field_9: f32,
pub field_10: f64,
pub field_11: String,
pub field_12: Vec<u8>,
}
#[fce] #[fce]
pub fn mutate_struct(mut test_record: TestRecord) -> TestRecord { pub fn mutate_struct(mut test_record: TestRecord) -> TestRecord {
test_record.field_0 = true; test_record.field_0 = true;

View File

@ -10,3 +10,4 @@ path = "src/main.rs"
[dependencies] [dependencies]
fluence = { git = "https://github.com/fluencelabs/rust-sdk" } fluence = { git = "https://github.com/fluencelabs/rust-sdk" }
test-record = { path = "../test-record" }

View File

@ -15,26 +15,10 @@
*/ */
use fluence::fce; use fluence::fce;
use test_record::TestRecord;
pub fn main() {} pub fn main() {}
#[fce]
pub struct TestRecord {
pub field_0: bool,
pub field_1: i8,
pub field_2: i16,
pub field_3: i32,
pub field_4: i64,
pub field_5: u8,
pub field_6: u16,
pub field_7: u32,
pub field_8: u64,
pub field_9: f32,
pub field_10: f64,
pub field_11: String,
pub field_12: Vec<u8>,
}
#[fce] #[fce]
pub fn invoke() -> TestRecord { pub fn invoke() -> TestRecord {
let test_record = TestRecord { let test_record = TestRecord {

View File

@ -0,0 +1,12 @@
[package]
name = "test-record"
version = "0.1.0"
authors = ["Fluence Labs"]
edition = "2018"
[lib]
name = "test_record"
path = "src/test_record.rs"
[dependencies]
fluence = { git = "https://github.com/fluencelabs/rust-sdk" }

View File

@ -0,0 +1,32 @@
/*
* 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.
* 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.
*/
#[fluence::fce]
pub struct TestRecord {
pub field_0: bool,
pub field_1: i8,
pub field_2: i16,
pub field_3: i32,
pub field_4: i64,
pub field_5: u8,
pub field_6: u16,
pub field_7: u32,
pub field_8: u64,
pub field_9: f32,
pub field_10: f64,
pub field_11: String,
pub field_12: Vec<u8>,
}