I wanted to define these in the same module as
#[cfg(target_os = "linux")]
const OS: &str = "Linux"
const OFFSET: usize = 0xa;
#[cfg(target_os = "windows")]
const OS: &str = "Windows"
const OFFSET: usize = 0x8;
However, I get an error for OFFSET refined. So, it takes only the first definition under #[cfg] attr. Is there a way to group?
As a workaround, I could do something like defining in two different modules linux.rs and windows.rs and do the below and it perfectly works, but I would like to know if there is a way to make the first option work.
#[cfg(target_os = "linux")]
use crate::linux::*;
#[cfg(target_os = "windows")]
use crate::windows::*;
Source: View source