diff options
Diffstat (limited to 'tests/rust/const_generics.rs')
-rw-r--r-- | tests/rust/const_generics.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/rust/const_generics.rs b/tests/rust/const_generics.rs new file mode 100644 index 0000000..081b38e --- /dev/null +++ b/tests/rust/const_generics.rs @@ -0,0 +1,15 @@ +#[repr(transparent)] +pub struct CArrayString<const CAP: usize> { + pub chars: [i8; CAP], +} + +pub const TITLE_SIZE: usize = 80; + +#[repr(C)] +pub struct Book { + pub title: CArrayString<TITLE_SIZE>, + pub author: CArrayString<40>, +} + +#[no_mangle] +pub extern "C" fn root(a: *mut Book) {} |