Hi there!
I'm currently creating an interface to a C library that has an structure with a field of char name[11];
, which I have implemented in Rust as name: [c_char; 11]
. I hope is OK. The thing is that I need to create some instances of the struct as constants, which in C is pretty easy:
const NtruEncParams EES401EP1 = {
"EES401EP1", /* name */
// Other fields
};
which I don't know how to implement. Of course, I have tried the following without success:
const EES677EP1: NtruEncParams = NtruEncParams {
name: "EES677EP1",
// Other fields
};
I get the following:
expected [i8; 11]
,
found &'static str
(expected array of 11 elements,
found &-ptr) [E0308]
Which would be the best option to do it in Rust?