INNER CODE UNIT · Rust

parse_key_val

zkonduit/ezkl · src/lib.rs:453

fn parse_key_val<T, U>(
    s: &str,
) -> Result<(T, U), Box<dyn std::error::Error + Send + Sync + 'static>>
where
    T: std::str::FromStr + std::fmt::Debug,
    T::Err: std::error::Error + Send + Sync + 'static,
    U: std::str::FromStr + std::fmt::Debug,
    U::Err: std::error::Error + Send + Sync + 'static,
{
    let pos = s
        .find("->")
        .ok_or_else(|| format!("invalid KEY->VALUE: no `->` found in `{s}`"))?;
    Ok((s[..pos].parse()?, s[pos + 2..].parse()?))
}

/// Verifies that a version string matches the expected artifact version
/// Logs warnings for version mismatches or unversioned artifacts
///

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…