From 24ef8f333ba40205cea32b33d2c9649bf89ee4ff Mon Sep 17 00:00:00 2001 From: Bengineer Date: Tue, 31 Dec 2024 00:50:37 +0000 Subject: [PATCH] Support for fixed sized arrays in models #2785: Added introspect --- crates/dojo/core/src/meta/introspect.cairo | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crates/dojo/core/src/meta/introspect.cairo b/crates/dojo/core/src/meta/introspect.cairo index 5c88b3a9ca..c96993e648 100644 --- a/crates/dojo/core/src/meta/introspect.cairo +++ b/crates/dojo/core/src/meta/introspect.cairo @@ -91,6 +91,21 @@ pub impl Introspect_bool of Introspect { } } +pub impl Introspect_FixedArray> of Introspect<[T; N]> { + fn size() -> Option { + match Introspect::::size() { + Option::Some(size) => Option::Some(size * N), + Option::None => Option::None + } + } + fn layout() -> Layout { + Layout::FixedArray([(Introspect::::layout(), N)].span()) + } + fn ty() -> Ty { + Ty::FixedArray([(Introspect::::ty(), N)].span()) + } +} + pub impl Introspect_u8 of Introspect { fn size() -> Option { Option::Some(1)