{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreigzafgim7k47u7bqlwmlgvwamce5q7k4wbdiobdthrhjisrbfniaa",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mh2wdxnbjxv2"
},
"path": "/t/idea-add-an-option-to-set-the-mode-to-fs-copy/24080#post_8",
"publishedAt": "2026-03-14T22:48:52.000Z",
"site": "https://internals.rust-lang.org",
"tags": [
"`NtCopyFileChunk`",
"Linux's `copy_file_range` also doesn't do the whole job and doesn't work in all cases"
],
"textContent": "chrisd:\n\n> On Windows ... there's no single function to copy using file handles ... there are some low-level functions which can help, such as `NtCopyFileChunk`, but [it doesn't do the whole job and] doesn't work in all cases ...\n\nLinux's `copy_file_range` also doesn't do the whole job and doesn't work in all cases; callers need to check for a \"can't do it this time\" error return and fall back to a manual copy loop. It sounds like the Windows implementation of `io::copy` might usefully be taught to use `NtCopyFileChunk` if it doesn't already, but `fs::copy` on Windows should keep using `CopyFile`, would you agree?",
"title": "Idea: Add an option to set the mode to fs::copy"
}