Rust

[Rust lang] 92. attribute part

밍글링글링 2023. 3. 30.
728x90
#[cfg(target_os = "linux")]
fn do_something_if_linux() {
    println!("I am running in Linux");
}

#[cfg(target_os = "windows")]
fn do_something() {
    println!("I am running in Windows");
}

struct JustAStruct {}

fn main() {
    let some_char = 'a';
    do_something();
}
#[test]
fn tests_a_thing() {

}

#[test]
fn tests_another_thing() {

}

#[deprecated]
fn test() {
    
}

fn main() {

}
728x90

'Rust' 카테고리의 다른 글

[Rust lang] 94. add trait  (0) 2023.03.30
[Rust lang] 93. deref trait  (0) 2023.03.30
[Rust lang] 91. about impl trait  (0) 2023.03.30
[Rust lang] 90. fn mut fnonce  (0) 2023.03.30
[Rust lang] 89. function pointers  (0) 2023.03.30

댓글