summaryrefslogtreecommitdiffstats
path: root/tests/rust/const_generics.rs
blob: 081b38e247f0b2606e04532272df7eb341763087 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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) {}