Rust

Conditional compilation (#[cfg])

Në shqip: Kompajlimi me kusht në Rust

ShpjegimiSQ

#[cfg(target_os = "windows")] përfshin kodin vetëm në Windows; #[cfg(feature = "json")] vetëm kur aktivizohet ajo veçori; cfg!() e kontrollon si bool.

EnglishEN

#[cfg(target_os = "windows")] includes code only on Windows; #[cfg(feature = "json")] only when that feature is enabled; cfg!() checks it as a bool.

Si ta mendosh

Si udhëzimet „vetëm për dimër“ në një manual.

Lexoje në anglisht

Like “winter only” instructions in a manual.

Shembull kodirust

#[cfg(target_os = "windows")]
const NDARESI: char = '\\';
#[cfg(not(target_os = "windows"))]
const NDARESI: char = '/';

Terma të lidhur