Standard Library · ffi
attribute inline
Makes a Block field of a @repr("C") struct a fixed array of bytes stored inside the struct.
since 0.1.0-alpha.1linuxwindowswasm
Examples
A byte array inside a struct
uses ffi;
use io::console;
use ffi;
@repr("C")
struct Tagged {
int32 id;
@inline(8) Block name;
}
comptime int size = ffi::sizeOf::<Tagged>();
comptime int nameAt = ffi::offsetOf::<Tagged>("name");
console.writeln(size);
console.writeln(nameAt);
12
4
Fields
bytes
int bytesThe number of bytes the field occupies.