Skip to content

Commit

Permalink
macros: made the serialized size to be always dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
piniom committed Sep 30, 2024
1 parent cc7557d commit 0addb52
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/cairo-serde-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,15 @@ pub fn derive(input: TokenStream) -> TokenStream {
}
};

// There is no easy way to check for the members being staticaly sized at compile time.
// Any of the members of the composite type can have a dynamic size.
// This is why we return `None` for the `SERIALIZED_SIZE` constant.
let output = quote! {
impl ::cainome::cairo_serde::CairoSerde for #ident {
type RustType = Self;

const SERIALIZED_SIZE: Option<usize> = None;

#cairo_serialized_size
#cairo_serialize
#cairo_deserialize
Expand Down

0 comments on commit 0addb52

Please sign in to comment.