FileExt consistency

I'm looking at the FileExt traits on different operating systems and it seems like the main four (windows, unix and macos, linux, wasi) all support the same operation of writing and reading at an offset. I wonder why this function is not implemented on the File type itself if most targets seem to support it but I know that there have been complex discussions about the design of IO and that the operation is technically redundant as it can be achieved via seek+write, so that doesn't bother me.

However I don't understand why on windows there's no write_all_at/read_all_at variant. On all the other systems there's a provided method on the trait which repeatedly calls the write_at/read_at in the same way that write_all is provided on the write trait. Why is it not provided on Windows?

2 Likes

We have, in the past, largely refrained from providing functions on a type unless we expect every target to support those functions.

I personally hope we can change that in the future, by using bounds instead to make functions always exist but only be callable on targets where they'll work. But that will take a fair bit of work.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.