INNER CODE UNIT · Rust

addr32

Quantova/QCore.js · src/lib.rs:177

fn addr32(hex: &str) -> Result<[u8; 32], JsError> {
    let bytes = qcore::json::from_hex(hex).map_err(|e| JsError::new(&e))?;
    bytes
        .try_into()
        .map_err(|_| JsError::new("expected 32 bytes of hex"))
}

fn u64_list(csv: &str) -> Result<Vec<u64>, JsError> {
    if csv.trim().is_empty() {
        return Ok(Vec::new());
    }
    csv.split(',')
        .map(|part| {
            part.trim()
                .parse::<u64>()
                .map_err(|_| JsError::new("a list entry is not a whole number"))
        })
        .collect()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…