make fce_generated_serialize work wirh self ref

This commit is contained in:
vms 2020-08-22 12:04:47 +03:00
parent 48bc0e52e2
commit b3a8f3cc31
2 changed files with 3 additions and 3 deletions

View File

@ -56,7 +56,7 @@ pub trait FCEStructSerializable {
// Serialize the provided record to a Vec<u8>, returns pointer to it in a form compatible with // Serialize the provided record to a Vec<u8>, returns pointer to it in a form compatible with
// record.lift_memory. // record.lift_memory.
// The caller should manage the lifetime of returned pointer. // The caller should manage the lifetime of returned pointer.
fn __fce_generated_serialize(self) -> *const u8; fn __fce_generated_serialize(&self) -> *const u8;
// Deserialize record from a pointer (normally, come from record.lower_memory). // Deserialize record from a pointer (normally, come from record.lower_memory).
unsafe fn __fce_generated_deserialize(record_ptr: *const u8) -> Self; unsafe fn __fce_generated_deserialize(record_ptr: *const u8) -> Self;

View File

@ -79,8 +79,8 @@ fn generate_serializer_fn(record: &fce_ast_types::AstRecordItem) -> proc_macro2:
let serializer = record.generate_serializer(); let serializer = record.generate_serializer();
quote::quote! { quote::quote! {
fn __fce_generated_serialize(self) -> *const u8 { fn __fce_generated_serialize(&self) -> *const u8 {
let mut raw_record = Vec::new(); let mut raw_record: Vec<u64> = Vec::new();
#serializer #serializer