fn url_to_oci(uri: &Url) -> anyhow::Result<Reference> {
    let name = uri.path().trim_start_matches("/");
    let port = uri
        .port()
        .and_then(|p| Some(format!(":{}", p)))
        .unwrap_or_else(|| "".to_owned());
    let r: Reference = match uri.host() {
        Some(host) => format!("{}{}/{}", host, port, name).parse(),
        None => name.parse(),
    }?;
    Ok(r) // Because who doesn't love OKRs.
}
/// Build the image name from the URL passed in.
/// So oci://example.com/foo:latest will become example.com/foo:latest
///
/// If parsing fails, this will emit an error.
Build the image name from the URL passed in.

If parsing fails, this will emit an error.
Build the image name from the URL passed in . If parsing fails this will emit an error .
fn url_to_oci(uri: &Url) -> anyhow::Result<Reference> {
    let name = uri.path().trim_start_matches("/");
    let port = uri
        .port()
        .and_then(|p| Some(format!(":{}", p)))
        .unwrap_or_else(|| "".to_owned());
    let r: Reference = match uri.host() {
        Some(host) => format!("{}{}/{}", host, port, name).parse(),
        None => name.parse(),
    }?;
    Ok(r) // Because who doesn't love OKRs.
}
fn url_to_oci ( uri : & Url ) -> anyhow :: Result < Reference > { let name = uri . path ( ) . trim_start_matches ( " " ) ; let port = uri . port ( ) . and_then ( | p | Some ( format ! ( " " p ) ) ) . unwrap_or_else ( | | " " . to_owned ( ) ) ; let r : Reference = match uri . host ( ) { Some ( host ) => format ! ( " " host port name ) . parse ( ) , None => name . parse ( ) , } ? ; Ok ( r ) // Because who doesn't love OKRs. }
Build the image name from the URL passed in.
Build the image name from the URL passed in .
uri
&Url