|
|
|
|
|
by bluejekyll
1636 days ago
|
|
There are many examples out there of ways to deal with conditional compilation in Rust, and I find it much more straightforward and simple than my own personal experience with C. Take a look at the socket2 crate as a nice way to deal with different platforms. The rule of thumb I would use is encode logic as much as possible into traits, and then abstract out specific arch details like fields etc. You can combine conditional compilation units with trait based support as well to reduce the annotations and instead provide functionality only for types that implement certain traits. |
|