INNER CODE UNIT · Rust

Ok

bminixhofer/nlprule · python/src/lib.rs:41

        if let Ok(bytes) = fs::read(path) {
            return Ok(Cursor::new(bytes));
        }
    }

    // ... otherwise, request the data from the URL ...
    let bytes = reqwest::blocking::get(&format!(
        "https://github.com/bminixhofer/nlprule/releases/download/{}/{}_{}",
        env!("CARGO_PKG_VERSION"),
        lang_code,
        name
    ))
    .and_then(|x| x.error_for_status())
    .and_then(|x| x.bytes())
    .map_err(|x| PyValueError::new_err(format!("{}", x)))?;

    let mut gz = GzDecoder::new(&bytes[..]);
    let mut buffer = Vec::new();

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…