Conditional compilation based on crate type

from blog osa1.net - All posts, | ↗ original
Suppose you have a no_std crate that you want to use in two ways: As a self-contained static library, to link with other (non-Rust) code As a Rust library, to import from another crate to test it (1) is the main use case for this library. (2) is because you want to test this library and you want to be able to use Rust’s std and other Rust...