reflink_copy

Function check_reflink_support

Source
pub fn check_reflink_support(
    from: impl AsRef<Path>,
    to: impl AsRef<Path>,
) -> Result<ReflinkSupport>
Expand description

Checks whether reflink is supported on the filesystem for the specified source and target paths.

This function verifies that both paths are on the same volume and that the filesystem supports reflink.

Note: Currently the function works only for windows. It returns Ok(ReflinkSupport::Unknown) for any other platform.

ยงExample

fn main() -> std::io::Result<()> {
    let support = reflink_copy::check_reflink_support("C:\\path\\to\\file", "C:\\path\\to\\another_file")?;
    println!("{support:?}");
    let support = reflink_copy::check_reflink_support("path\\to\\folder", "path\\to\\another_folder")?;
    println!("{support:?}");
    Ok(())
}