Quantcast
Channel: Use C-Like Array of Struct in Rust - Stack Overflow
Browsing all 2 articles
Browse latest View live

Answer by nodakai for Use C-Like Array of Struct in Rust

Your attempt was almost correct except you need to write out struct constructor with the name (no shortcut in Rust)Note also that Rust has const in addition to static. (const in Rust is roughly...

View Article



Use C-Like Array of Struct in Rust

I need help converting the following C code to Rust.#define v0 0x0#define v1 0x1#define v2 0x2#define v3 0x3struct arr { u_int v; const char *s;};static const struct arr str[] = { { v0, "zero" }, { v1,...

View Article
Browsing all 2 articles
Browse latest View live




Latest Images