fix boolean vec ser scheme

This commit is contained in:
vms 2021-04-22 17:24:07 +03:00
parent 77397bb87d
commit 766da0bf0f

View File

@ -28,8 +28,14 @@ pub(crate) fn generate_vector_ser(
arg_name: &str,
) -> proc_macro2::TokenStream {
let values_ser = match value_ty {
ParsedType::Boolean(_)
| ParsedType::I8(_)
ParsedType::Boolean(_) => {
quote! {
let converted_bool_vector: Vec<u8> = arg.into_iter().map(|v| v as u8).collect::<_>();
fluence::internal::add_object_to_release(Box::new(converted_bool_vector));
(converted_bool_vector.as_ptr() as _, converted_bool_vector.len() as _)
}
},
ParsedType::I8(_)
| ParsedType::U8(_)
| ParsedType::I16(_)
| ParsedType::U16(_)