[go: up one dir, main page]

pub fn copy_hash_unchecked_sync<P, Q>(
    cache: P,
    sri: &Integrity,
    to: Q
) -> Result<u64>
where P: AsRef<Path>, Q: AsRef<Path>,
Expand description

Copies a cache entry by integrity address to a specified location. Does not verify cache contents while copying.

On platforms that support it, this will create a copy-on-write “reflink” with a full-copy fallback.

§Example

use std::io::Read;

fn main() -> cacache::Result<()> {
    let sri = cacache::write_sync("./my-cache", "my-key", b"hello")?;
    cacache::copy_hash_unchecked_sync("./my-cache", &sri, "./my-hello.txt")?;
    Ok(())
}