0

From my experience from C/C++ domains, it would be very useful for a system programing language to be able to compile different codes based on different conditions.

I already know in Rust we got Attributes, attributes like windows_subsystem can enable/disable code fragments based on current OS.

What I still can not figure out is, custom situation, like for example in C/C++:

#if ENABLE_VIDEO
 // ... code for video only
#endif

How can I achive similar in Rust?

too honest for this site
  • 12,050
  • 4
  • 30
  • 52
Galaxy
  • 1,129
  • 11
  • 27
  • 1
    Also see [How do I use conditional compilation with `cfg` and Cargo?](https://stackoverflow.com/questions/27632660/how-do-i-use-conditional-compilation-with-cfg-and-cargo) – ljedrz Aug 30 '18 at 08:33
  • @ljedrz Thanks, very helpful – Galaxy Aug 30 '18 at 08:38

0 Answers0