Skip to content

feat: add Windows CopyFileEx platform copy stub - #2975

Merged
oferchen merged 1 commit into
masterfrom
feat/platform-copy-windows
Mar 22, 2026
Merged

oferchen merged 1 commit into
masterfrom
feat/platform-copy-windows

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Add fast_io::copy_file_ex module with try_copy_file_ex(src, dst) wrapping Windows CopyFileExW syscall, following the same pattern as copy_file_range and sendfile in the fast_io crate
  • On Windows, uses COPY_FILE_NO_BUFFERING for files larger than 4 MB to bypass the system cache
  • Non-Windows stub returns ErrorKind::Unsupported for graceful fallback to standard copy
  • Refactors engine::local_copy::win_copy to delegate to the new fast_io primitive, removing duplicated FFI code
  • Adds windows-sys 0.59 dependency to fast_io (Windows target only, same version already used by engine)

Test plan

  • CI Windows build passes (validates the CopyFileExW FFI compiles correctly)
  • CI Linux/macOS builds pass (validates non-Windows stub compiles and existing tests pass)
  • fast_io::copy_file_ex tests verify Unsupported error on non-Windows platforms
  • engine::win_copy tests verify dual-path selection and content parity

Move the low-level CopyFileExW FFI wrapper from engine::local_copy::win_copy
into fast_io::copy_file_ex, consistent with the project convention of isolating
platform-specific unsafe I/O primitives (copy_file_range, sendfile) in the
fast_io crate.

- Add fast_io::copy_file_ex module with try_copy_file_ex(src, dst)
- Windows impl calls CopyFileExW with COPY_FILE_NO_BUFFERING for files > 4 MB
- Non-Windows stub returns ErrorKind::Unsupported for graceful fallback
- Add windows-sys 0.59 dependency to fast_io (Windows target only)
- Refactor engine::win_copy to delegate to fast_io::copy_file_ex
@github-actions github-actions Bot added the enhancement New feature or request label Mar 22, 2026
@oferchen
oferchen merged commit e2093ba into master Mar 22, 2026
12 of 17 checks passed
@oferchen
oferchen deleted the feat/platform-copy-windows branch March 22, 2026 14:10
oferchen added a commit that referenced this pull request May 1, 2026
Move the low-level CopyFileExW FFI wrapper from engine::local_copy::win_copy
into fast_io::copy_file_ex, consistent with the project convention of isolating
platform-specific unsafe I/O primitives (copy_file_range, sendfile) in the
fast_io crate.

- Add fast_io::copy_file_ex module with try_copy_file_ex(src, dst)
- Windows impl calls CopyFileExW with COPY_FILE_NO_BUFFERING for files > 4 MB
- Non-Windows stub returns ErrorKind::Unsupported for graceful fallback
- Add windows-sys 0.59 dependency to fast_io (Windows target only)
- Refactor engine::win_copy to delegate to fast_io::copy_file_ex
oferchen added a commit that referenced this pull request May 5, 2026
Move the low-level CopyFileExW FFI wrapper from engine::local_copy::win_copy
into fast_io::copy_file_ex, consistent with the project convention of isolating
platform-specific unsafe I/O primitives (copy_file_range, sendfile) in the
fast_io crate.

- Add fast_io::copy_file_ex module with try_copy_file_ex(src, dst)
- Windows impl calls CopyFileExW with COPY_FILE_NO_BUFFERING for files > 4 MB
- Non-Windows stub returns ErrorKind::Unsupported for graceful fallback
- Add windows-sys 0.59 dependency to fast_io (Windows target only)
- Refactor engine::win_copy to delegate to fast_io::copy_file_ex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant