Another question about cfg

Is it possible to have something like this in code and then in Cargo.toml set ETA to true or false?

#[cfg(ETA)]

Basically I don't know what to put in Cargo.toml in order to make it either "active";

Thank you

You are most likely looking for Cargo features.

https://doc.rust-lang.org/cargo/reference/features.html

But wouldn't that mean that I'd have to write?:

#[cfg(feature=ETA)]

You'd have to write #[cfg(feature = "ETA")] - if it's an optional part of your library, that is what you should be doing. Top-level cfg flags are usually reserved for specifying how the library is built rather than what parts of it are built.

Yes, but the ETA is basically a flag that I want to set true or false.
Something similar to C++ #ifdef SOME_FLAG

It is possible to set such flags with the --cfg argument, i.e.

RUSTFLAGS="--cfg ETA" cargo build

will enable code marked with #[cfg(ETA)]. Additionally, such a flag can also be set by a build script.

Sounds like an overkill tbh.
Thanks for the help.

You can also do it in build.rs.