Function clone_file_range

Source
pub fn clone_file_range<P: AsRef<Path>, Q: AsRef<Path>>(
    src: P,
    src_offset: u64,
    src_length: u64,
    dest: Q,
    dest_offset: u64,
) -> Result<()>
Expand description

Clone a range from a file using the FICLONERANGE syscall

This is mainly tested on the btrfs filesystem.

For the details on the limitations of this method, see man 2 ioctl_ficlonerange.

One of the more common limitations is that src_offset, src_length and dest_offset must be multiples of the filesystem block size. Expect this function to fail if that is not the case.