mirror of
https://github.com/fluencelabs/marine-rs-sdk-test
synced 2024-12-04 15:20:18 +00:00
fix tests
This commit is contained in:
parent
cbd2cf7c4a
commit
b6d0ecc11c
@ -17,43 +17,36 @@
|
||||
#[cfg(feature = "debug")]
|
||||
use super::log;
|
||||
|
||||
use std::alloc::alloc as global_alloc;
|
||||
use std::alloc::Layout;
|
||||
|
||||
/// Allocates memory area of specified size and returns its address.
|
||||
/// Returns 0 if supplied size is too long.
|
||||
/// Allocates memory area of specified size and type and returns its address.
|
||||
/// The returned
|
||||
#[no_mangle]
|
||||
pub unsafe fn allocate(size: usize) -> usize {
|
||||
let layout = match Layout::from_size_align(size, std::mem::align_of::<u8>()) {
|
||||
Ok(layout) => layout,
|
||||
// in this case a err may occur only in a case of too long allocating size,
|
||||
// so just return 0
|
||||
Err(_) => return 0,
|
||||
};
|
||||
pub unsafe fn allocate(elem_count: usize, elem_ty: usize) -> usize {
|
||||
let allocated_mem = allocate_impl(elem_count, elem_ty);
|
||||
|
||||
#[cfg(feature = "debug")]
|
||||
log(format!("sdk.allocate: {:?}\n", size));
|
||||
log(format!(
|
||||
"sdk.allocate: {} {} -> {}\n",
|
||||
elem_count, elem_ty, allocated_mem
|
||||
));
|
||||
|
||||
global_alloc(layout) as _
|
||||
allocated_mem
|
||||
}
|
||||
|
||||
/*
|
||||
/// Allocates memory area of specified size and returns its address.
|
||||
/// Returns 0 if supplied size is too long.
|
||||
#[no_mangle]
|
||||
pub unsafe fn allocate_vec(element_count: usize, align: usize) -> usize {
|
||||
let layout = match Layout::from_size_align(size, align) {
|
||||
Ok(layout) => layout,
|
||||
// in this case a err may occur only in a case of too long allocating size, or incompatible
|
||||
// so just return 0
|
||||
Err(_) => return 0,
|
||||
};
|
||||
|
||||
let layout = layout.repeat(element_count)
|
||||
|
||||
#[cfg(feature = "debug")]
|
||||
log(format!("sdk.allocate: {:?}\n", size));
|
||||
|
||||
global_alloc(layout) as _
|
||||
fn allocate_impl(elem_count: usize, elem_ty: usize) -> usize {
|
||||
// TODO: handle OOM
|
||||
// Such allocation scheme is needed to deal with layout
|
||||
match elem_ty {
|
||||
0 => Vec::<u8>::with_capacity(elem_count).as_ptr() as usize, // for booleans
|
||||
1 => Vec::<u8>::with_capacity(elem_count).as_ptr() as usize,
|
||||
2 => Vec::<u16>::with_capacity(elem_count).as_ptr() as usize,
|
||||
3 => Vec::<u32>::with_capacity(elem_count).as_ptr() as usize,
|
||||
4 => Vec::<u64>::with_capacity(elem_count).as_ptr() as usize,
|
||||
5 => Vec::<i8>::with_capacity(elem_count).as_ptr() as usize,
|
||||
6 => Vec::<i16>::with_capacity(elem_count).as_ptr() as usize,
|
||||
7 => Vec::<i32>::with_capacity(elem_count).as_ptr() as usize,
|
||||
8 => Vec::<i64>::with_capacity(elem_count).as_ptr() as usize,
|
||||
9 => Vec::<f32>::with_capacity(elem_count).as_ptr() as usize,
|
||||
10 => Vec::<f64>::with_capacity(elem_count).as_ptr() as usize,
|
||||
_ => Vec::<u8>::with_capacity(0).as_ptr() as usize, // it'll allocate 0 bytes
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
@ -122,7 +122,7 @@ pub(crate) fn generate_vector_deserializer(
|
||||
}
|
||||
ParsedType::Utf8Str(_) | ParsedType::Utf8String(_) => {
|
||||
quote! {
|
||||
let mut arg: Vec<u32> = Vec::from_raw_parts(offset as _, size as _, size as _);
|
||||
let mut arg: Vec<u32> = Vec::from_raw_parts(offset as _, (2 * size) as _, (2 * size) as _);
|
||||
let mut arg = arg.into_iter();
|
||||
let mut result = Vec::with_capacity(arg.len() / 2);
|
||||
|
||||
@ -145,7 +145,7 @@ pub(crate) fn generate_vector_deserializer(
|
||||
quote! {
|
||||
#inner_vector_deserializer
|
||||
|
||||
let mut arg: Vec<u32> = Vec::from_raw_parts(offset as _, size as _, size as _);
|
||||
let mut arg: Vec<u32> = Vec::from_raw_parts(offset as _, (2 * size) as _, (2 * size) as _);
|
||||
let mut result = Vec::with_capacity(arg.len());
|
||||
|
||||
let mut arg = arg.into_iter();
|
||||
|
@ -45,9 +45,9 @@ impl RecordSerGlueCodeGenerator for AstRecordItem {
|
||||
}
|
||||
ParsedType::Utf8Str(_) | ParsedType::Utf8String(_) => {
|
||||
quote! {
|
||||
let field_ident_ptr = #field_ident.as_ptr() as usize;
|
||||
let field_ident_ptr = #field_ident.as_ptr() as u32;
|
||||
raw_record.extend(&field_ident_ptr.to_le_bytes());
|
||||
raw_record.extend(&#field_ident.len().to_le_bytes());
|
||||
raw_record.extend(&(#field_ident.len() as u32).to_le_bytes());
|
||||
}
|
||||
}
|
||||
ParsedType::Vector(ty, passing_style) => {
|
||||
|
@ -8,30 +8,22 @@ pub fn inner_arrays_1(arg: Vec<Vec<Vec<Vec<u8>>>>) -> Vec<Vec<Vec<Vec<u8>>>> {
|
||||
#[allow(clippy::all)]
|
||||
pub unsafe fn __fce_generated_wrapper_func_inner_arrays_1(arg_0: u32, arg_1: u32) {
|
||||
unsafe fn __fce_generated_vec_deserializer_0(offset: u32, size: u32) -> Vec<Vec<Vec<Vec<u8>>>> {
|
||||
let size = size / 8;
|
||||
unsafe fn __fce_generated_vec_deserializer_0_Vec_Vec_u8__(
|
||||
offset: u32,
|
||||
size: u32
|
||||
) -> Vec<Vec<Vec<u8>>> {
|
||||
let size = size / 8;
|
||||
unsafe fn __fce_generated_vec_deserializer_0_Vec_Vec_u8___Vec_u8_(
|
||||
offset: u32,
|
||||
size: u32
|
||||
) -> Vec<Vec<u8>> {
|
||||
let size = size / 8;
|
||||
unsafe fn __fce_generated_vec_deserializer_0_Vec_Vec_u8___Vec_u8__u8(
|
||||
offset: u32,
|
||||
size: u32
|
||||
) -> Vec<u8> {
|
||||
let size = size / 8;
|
||||
let mut arg: Vec<u64> = Vec::from_raw_parts(offset as _, size as _, size as _);
|
||||
let mut result = Vec::with_capacity(arg.len());
|
||||
for value in arg {
|
||||
result.push(value as _);
|
||||
}
|
||||
result
|
||||
Vec::from_raw_parts(offset as _, size as _, size as _)
|
||||
}
|
||||
let mut arg: Vec<u64> = Vec::from_raw_parts(offset as _, size as _, size as _);
|
||||
let mut arg: Vec<u32> =
|
||||
Vec::from_raw_parts(offset as _, (2 * size) as _, (2 * size) as _);
|
||||
let mut result = Vec::with_capacity(arg.len());
|
||||
let mut arg = arg.into_iter();
|
||||
while let Some(offset) = arg.next() {
|
||||
@ -44,7 +36,8 @@ pub unsafe fn __fce_generated_wrapper_func_inner_arrays_1(arg_0: u32, arg_1: u32
|
||||
}
|
||||
result
|
||||
}
|
||||
let mut arg: Vec<u64> = Vec::from_raw_parts(offset as _, size as _, size as _);
|
||||
let mut arg: Vec<u32> =
|
||||
Vec::from_raw_parts(offset as _, (2 * size) as _, (2 * size) as _);
|
||||
let mut result = Vec::with_capacity(arg.len());
|
||||
let mut arg = arg.into_iter();
|
||||
while let Some(offset) = arg.next() {
|
||||
@ -55,7 +48,7 @@ pub unsafe fn __fce_generated_wrapper_func_inner_arrays_1(arg_0: u32, arg_1: u32
|
||||
}
|
||||
result
|
||||
}
|
||||
let mut arg: Vec<u64> = Vec::from_raw_parts(offset as _, size as _, size as _);
|
||||
let mut arg: Vec<u32> = Vec::from_raw_parts(offset as _, (2 * size) as _, (2 * size) as _);
|
||||
let mut result = Vec::with_capacity(arg.len());
|
||||
let mut arg = arg.into_iter();
|
||||
while let Some(offset) = arg.next() {
|
||||
@ -87,7 +80,7 @@ pub unsafe fn __fce_generated_wrapper_func_inner_arrays_1(arg_0: u32, arg_1: u32
|
||||
result.push(size as _);
|
||||
}
|
||||
let result_ptr = result.as_ptr();
|
||||
let result_len = 4 * result.len();
|
||||
let result_len = result.len();
|
||||
fluence::internal::add_object_to_release(Box::new(result));
|
||||
(result_ptr as _, result_len as _)
|
||||
}
|
||||
@ -98,7 +91,7 @@ pub unsafe fn __fce_generated_wrapper_func_inner_arrays_1(arg_0: u32, arg_1: u32
|
||||
result.push(size as _);
|
||||
}
|
||||
let result_ptr = result.as_ptr();
|
||||
let result_len = 4 * result.len();
|
||||
let result_len = result.len();
|
||||
fluence::internal::add_object_to_release(Box::new(result));
|
||||
(result_ptr as _, result_len as _)
|
||||
}
|
||||
@ -109,7 +102,7 @@ pub unsafe fn __fce_generated_wrapper_func_inner_arrays_1(arg_0: u32, arg_1: u32
|
||||
result.push(size as _);
|
||||
}
|
||||
let result_ptr = result.as_ptr();
|
||||
let result_len = 4 * result.len();
|
||||
let result_len = result.len();
|
||||
fluence::internal::add_object_to_release(Box::new(result));
|
||||
(result_ptr as _, result_len as _)
|
||||
}
|
||||
|
@ -47,13 +47,7 @@ pub unsafe fn __fce_generated_wrapper_func_all_types(
|
||||
let converted_arg_9 = arg_9 as _;
|
||||
let converted_arg_10 = String::from_raw_parts(arg_10 as _, arg_11 as _, arg_11 as _);
|
||||
unsafe fn __fce_generated_vec_deserializer_12(offset: u32, size: u32) -> Vec<u8> {
|
||||
let size = size / 8;
|
||||
let mut arg: Vec<u64> = Vec::from_raw_parts(offset as _, size as _, size as _);
|
||||
let mut result = Vec::with_capacity(arg.len());
|
||||
for value in arg {
|
||||
result.push(value as _);
|
||||
}
|
||||
result
|
||||
Vec::from_raw_parts(offset as _, size as _, size as _)
|
||||
}
|
||||
let converted_arg_12 = __fce_generated_vec_deserializer_12(arg_12 as _, arg_13 as _);
|
||||
let result = all_types(
|
||||
|
@ -8,10 +8,9 @@ pub fn test_array_refs(arg: &Vec<Vec<String>>) -> &Vec<Vec<Vec<Vec<String>>>> {
|
||||
#[allow(clippy::all)]
|
||||
pub unsafe fn __fce_generated_wrapper_func_test_array_refs(arg_0: u32, arg_1: u32) {
|
||||
unsafe fn __fce_generated_vec_deserializer_0(offset: u32, size: u32) -> Vec<Vec<String>> {
|
||||
let size = size / 8;
|
||||
unsafe fn __fce_generated_vec_deserializer_0_String(offset: u32, size: u32) -> Vec<String> {
|
||||
let size = size / 8;
|
||||
let mut arg: Vec<u64> = Vec::from_raw_parts(offset as _, size as _, size as _);
|
||||
let mut arg: Vec<u32> =
|
||||
Vec::from_raw_parts(offset as _, (2 * size) as _, (2 * size) as _);
|
||||
let mut arg = arg.into_iter();
|
||||
let mut result = Vec::with_capacity(arg.len() / 2);
|
||||
while let Some(offset) = arg.next() {
|
||||
@ -21,7 +20,7 @@ pub unsafe fn __fce_generated_wrapper_func_test_array_refs(arg_0: u32, arg_1: u3
|
||||
}
|
||||
result
|
||||
}
|
||||
let mut arg: Vec<u64> = Vec::from_raw_parts(offset as _, size as _, size as _);
|
||||
let mut arg: Vec<u32> = Vec::from_raw_parts(offset as _, (2 * size) as _, (2 * size) as _);
|
||||
let mut result = Vec::with_capacity(arg.len());
|
||||
let mut arg = arg.into_iter();
|
||||
while let Some(offset) = arg.next() {
|
||||
@ -49,7 +48,7 @@ pub unsafe fn __fce_generated_wrapper_func_test_array_refs(arg_0: u32, arg_1: u3
|
||||
result.push(value.len() as _);
|
||||
}
|
||||
let result_ptr = result.as_ptr();
|
||||
let result_len = 4 * result.len();
|
||||
let result_len = result.len();
|
||||
fluence::internal::add_object_to_release(Box::new(result));
|
||||
(result_ptr as _, result_len as _)
|
||||
}
|
||||
@ -61,7 +60,7 @@ pub unsafe fn __fce_generated_wrapper_func_test_array_refs(arg_0: u32, arg_1: u3
|
||||
result.push(size as _);
|
||||
}
|
||||
let result_ptr = result.as_ptr();
|
||||
let result_len = 4 * result.len();
|
||||
let result_len = result.len();
|
||||
fluence::internal::add_object_to_release(Box::new(result));
|
||||
(result_ptr as _, result_len as _)
|
||||
}
|
||||
@ -73,7 +72,7 @@ pub unsafe fn __fce_generated_wrapper_func_test_array_refs(arg_0: u32, arg_1: u3
|
||||
result.push(size as _);
|
||||
}
|
||||
let result_ptr = result.as_ptr();
|
||||
let result_len = 4 * result.len();
|
||||
let result_len = result.len();
|
||||
fluence::internal::add_object_to_release(Box::new(result));
|
||||
(result_ptr as _, result_len as _)
|
||||
}
|
||||
@ -84,7 +83,7 @@ pub unsafe fn __fce_generated_wrapper_func_test_array_refs(arg_0: u32, arg_1: u3
|
||||
result.push(size as _);
|
||||
}
|
||||
let result_ptr = result.as_ptr();
|
||||
let result_len = 4 * result.len();
|
||||
let result_len = result.len();
|
||||
fluence::internal::add_object_to_release(Box::new(result));
|
||||
(result_ptr as _, result_len as _)
|
||||
}
|
||||
|
@ -17,17 +17,22 @@ pub struct CallParameters {
|
||||
#[allow(clippy::all)]
|
||||
impl CallParameters {
|
||||
pub fn __fce_generated_serialize(&self) -> *const u8 {
|
||||
let mut raw_record: Vec<u64> = Vec::with_capacity(2 * 6usize);
|
||||
raw_record.push(self.init_peer_id.as_ptr() as _);
|
||||
raw_record.push(self.init_peer_id.len() as _);
|
||||
raw_record.push(self.service_id.as_ptr() as _);
|
||||
raw_record.push(self.service_id.len() as _);
|
||||
raw_record.push(self.service_creator_peer_id.as_ptr() as _);
|
||||
raw_record.push(self.service_creator_peer_id.len() as _);
|
||||
raw_record.push(self.host_id.as_ptr() as _);
|
||||
raw_record.push(self.host_id.len() as _);
|
||||
raw_record.push(self.particle_id.as_ptr() as _);
|
||||
raw_record.push(self.particle_id.len() as _);
|
||||
let mut raw_record: Vec<u8> = Vec::with_capacity(4 * 6usize);
|
||||
let field_ident_ptr = self.init_peer_id.as_ptr() as u32;
|
||||
raw_record.extend(&field_ident_ptr.to_le_bytes());
|
||||
raw_record.extend(&(self.init_peer_id.len() as u32).to_le_bytes());
|
||||
let field_ident_ptr = self.service_id.as_ptr() as u32;
|
||||
raw_record.extend(&field_ident_ptr.to_le_bytes());
|
||||
raw_record.extend(&(self.service_id.len() as u32).to_le_bytes());
|
||||
let field_ident_ptr = self.service_creator_peer_id.as_ptr() as u32;
|
||||
raw_record.extend(&field_ident_ptr.to_le_bytes());
|
||||
raw_record.extend(&(self.service_creator_peer_id.len() as u32).to_le_bytes());
|
||||
let field_ident_ptr = self.host_id.as_ptr() as u32;
|
||||
raw_record.extend(&field_ident_ptr.to_le_bytes());
|
||||
raw_record.extend(&(self.host_id.len() as u32).to_le_bytes());
|
||||
let field_ident_ptr = self.particle_id.as_ptr() as u32;
|
||||
raw_record.extend(&field_ident_ptr.to_le_bytes());
|
||||
raw_record.extend(&(self.particle_id.len() as u32).to_le_bytes());
|
||||
unsafe fn __fce_generated_vec_serializer_tetraplets_5(
|
||||
arg: &Vec<Vec<SecurityTetraplet>>
|
||||
) -> (u32, u32) {
|
||||
@ -39,7 +44,7 @@ impl CallParameters {
|
||||
result.push(value.__fce_generated_serialize() as _);
|
||||
}
|
||||
let result_ptr = result.as_ptr();
|
||||
let result_len = 4 * result.len();
|
||||
let result_len = result.len();
|
||||
fluence::internal::add_object_to_release(Box::new(result));
|
||||
(result_ptr as _, result_len as _)
|
||||
}
|
||||
@ -51,66 +56,104 @@ impl CallParameters {
|
||||
result.push(size as _);
|
||||
}
|
||||
let result_ptr = result.as_ptr();
|
||||
let result_len = 4 * result.len();
|
||||
let result_len = result.len();
|
||||
fluence::internal::add_object_to_release(Box::new(result));
|
||||
(result_ptr as _, result_len as _)
|
||||
}
|
||||
let serialized_arg_5 =
|
||||
unsafe { __fce_generated_vec_serializer_tetraplets_5(&self.tetraplets) };
|
||||
raw_record.push(serialized_arg_5.0 as _);
|
||||
raw_record.push(serialized_arg_5.1 as _);
|
||||
raw_record.extend(&serialized_arg_5.0.to_le_bytes());
|
||||
raw_record.extend(&serialized_arg_5.1.to_le_bytes());
|
||||
let raw_record_ptr = raw_record.as_ptr();
|
||||
fluence::internal::add_object_to_release(Box::new(raw_record));
|
||||
raw_record_ptr as _
|
||||
}
|
||||
pub unsafe fn __fce_generated_deserialize(record_ptr: *const u8) -> Self {
|
||||
let raw_record: Vec<u64> = Vec::from_raw_parts(record_ptr as _, 96usize, 96usize);
|
||||
let raw_record: Vec<u8> = Vec::from_raw_parts(record_ptr as _, 48usize, 48usize);
|
||||
let field_0 = unsafe {
|
||||
String::from_raw_parts(
|
||||
raw_record[0usize] as _,
|
||||
raw_record[1usize] as _,
|
||||
raw_record[1usize] as _
|
||||
)
|
||||
let offset = u32::from_le_bytes([
|
||||
raw_record[0usize],
|
||||
raw_record[0usize + 1],
|
||||
raw_record[0usize + 2],
|
||||
raw_record[0usize + 3],
|
||||
]);
|
||||
let size = u32::from_le_bytes([
|
||||
raw_record[0usize + 4],
|
||||
raw_record[0usize + 5],
|
||||
raw_record[0usize + 6],
|
||||
raw_record[0usize + 7],
|
||||
]);
|
||||
String::from_raw_parts(offset as _, size as _, size as _)
|
||||
};
|
||||
let field_1 = unsafe {
|
||||
String::from_raw_parts(
|
||||
raw_record[2usize] as _,
|
||||
raw_record[3usize] as _,
|
||||
raw_record[3usize] as _
|
||||
)
|
||||
let offset = u32::from_le_bytes([
|
||||
raw_record[8usize],
|
||||
raw_record[8usize + 1],
|
||||
raw_record[8usize + 2],
|
||||
raw_record[8usize + 3],
|
||||
]);
|
||||
let size = u32::from_le_bytes([
|
||||
raw_record[8usize + 4],
|
||||
raw_record[8usize + 5],
|
||||
raw_record[8usize + 6],
|
||||
raw_record[8usize + 7],
|
||||
]);
|
||||
String::from_raw_parts(offset as _, size as _, size as _)
|
||||
};
|
||||
let field_2 = unsafe {
|
||||
String::from_raw_parts(
|
||||
raw_record[4usize] as _,
|
||||
raw_record[5usize] as _,
|
||||
raw_record[5usize] as _
|
||||
)
|
||||
let offset = u32::from_le_bytes([
|
||||
raw_record[16usize],
|
||||
raw_record[16usize + 1],
|
||||
raw_record[16usize + 2],
|
||||
raw_record[16usize + 3],
|
||||
]);
|
||||
let size = u32::from_le_bytes([
|
||||
raw_record[16usize + 4],
|
||||
raw_record[16usize + 5],
|
||||
raw_record[16usize + 6],
|
||||
raw_record[16usize + 7],
|
||||
]);
|
||||
String::from_raw_parts(offset as _, size as _, size as _)
|
||||
};
|
||||
let field_3 = unsafe {
|
||||
String::from_raw_parts(
|
||||
raw_record[6usize] as _,
|
||||
raw_record[7usize] as _,
|
||||
raw_record[7usize] as _
|
||||
)
|
||||
let offset = u32::from_le_bytes([
|
||||
raw_record[24usize],
|
||||
raw_record[24usize + 1],
|
||||
raw_record[24usize + 2],
|
||||
raw_record[24usize + 3],
|
||||
]);
|
||||
let size = u32::from_le_bytes([
|
||||
raw_record[24usize + 4],
|
||||
raw_record[24usize + 5],
|
||||
raw_record[24usize + 6],
|
||||
raw_record[24usize + 7],
|
||||
]);
|
||||
String::from_raw_parts(offset as _, size as _, size as _)
|
||||
};
|
||||
let field_4 = unsafe {
|
||||
String::from_raw_parts(
|
||||
raw_record[8usize] as _,
|
||||
raw_record[9usize] as _,
|
||||
raw_record[9usize] as _
|
||||
)
|
||||
let offset = u32::from_le_bytes([
|
||||
raw_record[32usize],
|
||||
raw_record[32usize + 1],
|
||||
raw_record[32usize + 2],
|
||||
raw_record[32usize + 3],
|
||||
]);
|
||||
let size = u32::from_le_bytes([
|
||||
raw_record[32usize + 4],
|
||||
raw_record[32usize + 5],
|
||||
raw_record[32usize + 6],
|
||||
raw_record[32usize + 7],
|
||||
]);
|
||||
String::from_raw_parts(offset as _, size as _, size as _)
|
||||
};
|
||||
unsafe fn __fce_generated_vec_deserializer_10(
|
||||
unsafe fn __fce_generated_vec_deserializer_40(
|
||||
offset: u32,
|
||||
size: u32
|
||||
) -> Vec<Vec<SecurityTetraplet>> {
|
||||
let size = size / 8;
|
||||
unsafe fn __fce_generated_vec_deserializer_10_SecurityTetraplet(
|
||||
unsafe fn __fce_generated_vec_deserializer_40_SecurityTetraplet(
|
||||
offset: u32,
|
||||
size: u32
|
||||
) -> Vec<SecurityTetraplet> {
|
||||
let size = size / 8;
|
||||
let mut arg: Vec<u64> = Vec::from_raw_parts(offset as _, size as _, size as _);
|
||||
let mut arg: Vec<u32> = Vec::from_raw_parts(offset as _, size as _, size as _);
|
||||
let mut result = Vec::with_capacity(arg.len());
|
||||
for offset in arg {
|
||||
let value = SecurityTetraplet::__fce_generated_deserialize(offset as _);
|
||||
@ -118,12 +161,13 @@ impl CallParameters {
|
||||
}
|
||||
result
|
||||
}
|
||||
let mut arg: Vec<u64> = Vec::from_raw_parts(offset as _, size as _, size as _);
|
||||
let mut arg: Vec<u32> =
|
||||
Vec::from_raw_parts(offset as _, (2 * size) as _, (2 * size) as _);
|
||||
let mut result = Vec::with_capacity(arg.len());
|
||||
let mut arg = arg.into_iter();
|
||||
while let Some(offset) = arg.next() {
|
||||
let size = arg.next().unwrap();
|
||||
let value = __fce_generated_vec_deserializer_10_SecurityTetraplet(
|
||||
let value = __fce_generated_vec_deserializer_40_SecurityTetraplet(
|
||||
offset as _,
|
||||
size as _
|
||||
);
|
||||
@ -131,12 +175,19 @@ impl CallParameters {
|
||||
}
|
||||
result
|
||||
}
|
||||
let field_5 = unsafe {
|
||||
__fce_generated_vec_deserializer_10(
|
||||
raw_record[10usize] as _,
|
||||
raw_record[11usize] as _
|
||||
)
|
||||
};
|
||||
let offset = u32::from_le_bytes([
|
||||
raw_record[40usize],
|
||||
raw_record[40usize + 1],
|
||||
raw_record[40usize + 2],
|
||||
raw_record[40usize + 3],
|
||||
]);
|
||||
let size = u32::from_le_bytes([
|
||||
raw_record[40usize + 4],
|
||||
raw_record[40usize + 5],
|
||||
raw_record[40usize + 6],
|
||||
raw_record[40usize + 7],
|
||||
]);
|
||||
let field_5 = unsafe { __fce_generated_vec_deserializer_40(offset as _, size as _) };
|
||||
Self {
|
||||
init_peer_id: field_0,
|
||||
service_id: field_1,
|
||||
@ -151,6 +202,6 @@ impl CallParameters {
|
||||
#[doc(hidden)]
|
||||
#[allow(clippy::all)]
|
||||
#[link_section = "__fce_generated_section__CallParameters"]
|
||||
pub static __fce_generated_static_global_CallParameters: [u8; 445usize] = {
|
||||
* b"{\"ast_type\":\"Record\",\"name\":\"CallParameters\",\"fields\":[{\"name\":\"init_peer_id\",\"ty\":{\"Utf8String\":\"ByValue\"}},{\"name\":\"service_id\",\"ty\":{\"Utf8String\":\"ByValue\"}},{\"name\":\"service_creator_peer_id\",\"ty\":{\"Utf8String\":\"ByValue\"}},{\"name\":\"host_id\",\"ty\":{\"Utf8String\":\"ByValue\"}},{\"name\":\"particle_id\",\"ty\":{\"Utf8String\":\"ByValue\"}},{\"name\":\"tetraplets\",\"ty\":{\"Vector\":[{\"Vector\":[{\"Record\":[\"SecurityTetraplet\",\"ByValue\"]},\"ByValue\"]},\"ByValue\"]}}]}"
|
||||
pub static __fce_generated_static_global_CallParameters: [u8; 455usize] = {
|
||||
* b"{\"ast_type\":\"Record\",\"name\":\"CallParameters\",\"fields\":{\"Named\":[{\"name\":\"init_peer_id\",\"ty\":{\"Utf8String\":\"ByValue\"}},{\"name\":\"service_id\",\"ty\":{\"Utf8String\":\"ByValue\"}},{\"name\":\"service_creator_peer_id\",\"ty\":{\"Utf8String\":\"ByValue\"}},{\"name\":\"host_id\",\"ty\":{\"Utf8String\":\"ByValue\"}},{\"name\":\"particle_id\",\"ty\":{\"Utf8String\":\"ByValue\"}},{\"name\":\"tetraplets\",\"ty\":{\"Vector\":[{\"Vector\":[{\"Record\":[\"SecurityTetraplet\",\"ByValue\"]},\"ByValue\"]},\"ByValue\"]}}]}}"
|
||||
};
|
||||
|
@ -11,23 +11,19 @@ pub unsafe fn __fce_generated_wrapper_func_inner_arrays_2(arg_0: u32, arg_1: u32
|
||||
offset: u32,
|
||||
size: u32
|
||||
) -> Vec<Vec<Vec<Vec<TestRecord>>>> {
|
||||
let size = size / 8;
|
||||
unsafe fn __fce_generated_vec_deserializer_0_Vec_Vec_TestRecord__(
|
||||
offset: u32,
|
||||
size: u32
|
||||
) -> Vec<Vec<Vec<TestRecord>>> {
|
||||
let size = size / 8;
|
||||
unsafe fn __fce_generated_vec_deserializer_0_Vec_Vec_TestRecord___Vec_TestRecord_(
|
||||
offset: u32,
|
||||
size: u32
|
||||
) -> Vec<Vec<TestRecord>> {
|
||||
let size = size / 8;
|
||||
unsafe fn __fce_generated_vec_deserializer_0_Vec_Vec_TestRecord___Vec_TestRecord__TestRecord(
|
||||
offset: u32,
|
||||
size: u32
|
||||
) -> Vec<TestRecord> {
|
||||
let size = size / 8;
|
||||
let mut arg: Vec<u64> = Vec::from_raw_parts(offset as _, size as _, size as _);
|
||||
let mut arg: Vec<u32> = Vec::from_raw_parts(offset as _, size as _, size as _);
|
||||
let mut result = Vec::with_capacity(arg.len());
|
||||
for offset in arg {
|
||||
let value = TestRecord::__fce_generated_deserialize(offset as _);
|
||||
@ -35,7 +31,8 @@ pub unsafe fn __fce_generated_wrapper_func_inner_arrays_2(arg_0: u32, arg_1: u32
|
||||
}
|
||||
result
|
||||
}
|
||||
let mut arg: Vec<u64> = Vec::from_raw_parts(offset as _, size as _, size as _);
|
||||
let mut arg: Vec<u32> =
|
||||
Vec::from_raw_parts(offset as _, (2 * size) as _, (2 * size) as _);
|
||||
let mut result = Vec::with_capacity(arg.len());
|
||||
let mut arg = arg.into_iter();
|
||||
while let Some(offset) = arg.next() {
|
||||
@ -45,7 +42,8 @@ pub unsafe fn __fce_generated_wrapper_func_inner_arrays_2(arg_0: u32, arg_1: u32
|
||||
}
|
||||
result
|
||||
}
|
||||
let mut arg: Vec<u64> = Vec::from_raw_parts(offset as _, size as _, size as _);
|
||||
let mut arg: Vec<u32> =
|
||||
Vec::from_raw_parts(offset as _, (2 * size) as _, (2 * size) as _);
|
||||
let mut result = Vec::with_capacity(arg.len());
|
||||
let mut arg = arg.into_iter();
|
||||
while let Some(offset) = arg.next() {
|
||||
@ -58,7 +56,7 @@ pub unsafe fn __fce_generated_wrapper_func_inner_arrays_2(arg_0: u32, arg_1: u32
|
||||
}
|
||||
result
|
||||
}
|
||||
let mut arg: Vec<u64> = Vec::from_raw_parts(offset as _, size as _, size as _);
|
||||
let mut arg: Vec<u32> = Vec::from_raw_parts(offset as _, (2 * size) as _, (2 * size) as _);
|
||||
let mut result = Vec::with_capacity(arg.len());
|
||||
let mut arg = arg.into_iter();
|
||||
while let Some(offset) = arg.next() {
|
||||
@ -86,7 +84,7 @@ pub unsafe fn __fce_generated_wrapper_func_inner_arrays_2(arg_0: u32, arg_1: u32
|
||||
result.push(value.__fce_generated_serialize() as _);
|
||||
}
|
||||
let result_ptr = result.as_ptr();
|
||||
let result_len = 4 * result.len();
|
||||
let result_len = result.len();
|
||||
fluence::internal::add_object_to_release(Box::new(result));
|
||||
(result_ptr as _, result_len as _)
|
||||
}
|
||||
@ -97,7 +95,7 @@ pub unsafe fn __fce_generated_wrapper_func_inner_arrays_2(arg_0: u32, arg_1: u32
|
||||
result.push(size as _);
|
||||
}
|
||||
let result_ptr = result.as_ptr();
|
||||
let result_len = 4 * result.len();
|
||||
let result_len = result.len();
|
||||
fluence::internal::add_object_to_release(Box::new(result));
|
||||
(result_ptr as _, result_len as _)
|
||||
}
|
||||
@ -109,7 +107,7 @@ pub unsafe fn __fce_generated_wrapper_func_inner_arrays_2(arg_0: u32, arg_1: u32
|
||||
result.push(size as _);
|
||||
}
|
||||
let result_ptr = result.as_ptr();
|
||||
let result_len = 4 * result.len();
|
||||
let result_len = result.len();
|
||||
fluence::internal::add_object_to_release(Box::new(result));
|
||||
(result_ptr as _, result_len as _)
|
||||
}
|
||||
@ -120,7 +118,7 @@ pub unsafe fn __fce_generated_wrapper_func_inner_arrays_2(arg_0: u32, arg_1: u32
|
||||
result.push(size as _);
|
||||
}
|
||||
let result_ptr = result.as_ptr();
|
||||
let result_len = 4 * result.len();
|
||||
let result_len = result.len();
|
||||
fluence::internal::add_object_to_release(Box::new(result));
|
||||
(result_ptr as _, result_len as _)
|
||||
}
|
||||
@ -137,4 +135,4 @@ pub unsafe fn __fce_generated_wrapper_func_inner_arrays_2(arg_0: u32, arg_1: u32
|
||||
#[link_section = "__fce_generated_section__inner_arrays_2"]
|
||||
pub static __fce_generated_static_global_inner_arrays_2: [u8; 365usize] = {
|
||||
* b"{\"ast_type\":\"Function\",\"signature\":{\"name\":\"inner_arrays_2\",\"arguments\":[{\"name\":\"arg\",\"ty\":{\"Vector\":[{\"Vector\":[{\"Vector\":[{\"Vector\":[{\"Record\":[\"TestRecord\",\"ByValue\"]},\"ByValue\"]},\"ByValue\"]},\"ByValue\"]},\"ByValue\"]}}],\"output_type\":{\"Vector\":[{\"Vector\":[{\"Vector\":[{\"Vector\":[{\"Record\":[\"TestRecord\",\"ByValue\"]},\"ByValue\"]},\"ByValue\"]},\"ByValue\"]},\"ByValue\"]}}}"
|
||||
};
|
||||
};
|
@ -16,12 +16,12 @@
|
||||
|
||||
use fluence_sdk_macro::fce;
|
||||
|
||||
use serde::Serialize;
|
||||
use serde::Deserialize;
|
||||
// use serde::Serialize;
|
||||
// use serde::Deserialize;
|
||||
|
||||
/// Describes an origin that set an argument.
|
||||
#[fce]
|
||||
#[derive(Clone, PartialEq, Default, Eq, Debug, Serialize, Deserialize)]
|
||||
// #[derive(Clone, PartialEq, Default, Eq, Debug, Serialize, Deserialize)]
|
||||
pub struct SecurityTetraplet {
|
||||
pub peer_pk: String,
|
||||
pub service_id: String,
|
||||
@ -31,7 +31,7 @@ pub struct SecurityTetraplet {
|
||||
|
||||
/// This struct contains parameters that would be accessible by Wasm modules.
|
||||
#[fce]
|
||||
#[derive(Clone, PartialEq, Default, Eq, Debug, Serialize, Deserialize)]
|
||||
// #[derive(Clone, PartialEq, Default, Eq, Debug, Serialize, Deserialize)]
|
||||
pub struct CallParameters {
|
||||
/// Peer id of the AIR script initiator.
|
||||
pub init_peer_id: String,
|
||||
|
@ -31,6 +31,11 @@ pub fn string_type(_arg: Vec<String>) -> Vec<String> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
#[fce]
|
||||
pub fn bool_type(_arg: Vec<bool>) -> Vec<bool> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
#[fce]
|
||||
pub fn f32_type(_arg: Vec<f32>) -> Vec<f32> {
|
||||
unimplemented!()
|
||||
|
@ -31,6 +31,11 @@ pub fn string_type(_arg: &Vec<String>) -> &Vec<String> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
#[fce]
|
||||
pub fn bool_type(_arg: &Vec<bool>) -> &Vec<bool> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
#[fce]
|
||||
pub fn f32_type(_arg: &Vec<f32>) -> &Vec<f32> {
|
||||
unimplemented!()
|
||||
|
@ -22,6 +22,8 @@ extern "C" {
|
||||
|
||||
pub fn string_type(arg: Vec<String>) -> Vec<String>;
|
||||
|
||||
pub fn bool_type(arg: Vec<bool>) -> Vec<bool>;
|
||||
|
||||
pub fn byte_type(arg: Vec<u8>) -> Vec<u8>;
|
||||
|
||||
pub fn f32_type(arg: Vec<f32>) -> Vec<f32>;
|
||||
|
@ -42,6 +42,8 @@ extern "C" {
|
||||
|
||||
pub fn string_type(arg: &Vec<String>) -> Vec<String>;
|
||||
|
||||
pub fn bool_type(arg: &Vec<bool>) -> Vec<bool>;
|
||||
|
||||
pub fn byte_type(arg: &Vec<u8>) -> Vec<u8>;
|
||||
|
||||
pub fn f32_type(arg: &Vec<f32>) -> Vec<f32>;
|
||||
|
Loading…
Reference in New Issue
Block a user