Felienne Hermans
Felienne Hermans
December 8th, 2021

Code Reading Club Reading Countdown - 8

Article cover photo

Countdown - Snippet 8

Today's code reading countdown in Rust.

Snippet

CRCRC-8

Snippet in text

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PartialTargetTriple {
    pub arch: Option<String>,
    pub os: Option<String>,
    pub env: Option<String>,
}

fn from_build() -> Result<PartialTargetTriple, String> {
    let triple = if let Ok(triple) = env::var("RUSTUP_OVERRIDE_BUILD_TRIPLE") {
        triple
    } else {
        env::var("TARGET").unwrap()
    };
    PartialTargetTriple::new(&triple).ok_or(triple)
}

Question

Give an example of a return value of from_build()

Submission

Submit your answer in our form.