Context
In my application, I'm presently using std::fs::copy
to copy some files. The underlying implementations of this function for the platforms I'm interested in call out to the private function open_to_and_set_permissions
. I would like to make a slight modification to open_to_and_set_permissions
for the sake of avoiding additional syscalls which happen to be unnecessary for my use-case in a particularly performance-critical portion of my application.
Core issue
Is there any way to replace the implementation of a single private function from the standard library (in this case open_to_and_set_permissions
)? I realize that I could solve my problem by literally copy-pasting the definitions of all of the relevant functions into my own crate, and calling those functions instead, but I'd like to avoid resorting to that if at all possible.