-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use tell
for <File as Seek>::stream_position
#137165
Conversation
r? @ChrisDenton rustbot has assigned @ChrisDenton. Use |
For platforms that don't have a |
Also cc @kawadakk for changes to SOLID. |
7ac71fa
to
632a248
Compare
I was thinking that eliminating the match would be good, since these aren't(?) inlined, but that's also a good approach. Updated. |
632a248
to
09ecf34
Compare
09ecf34
to
7112474
Compare
Another approach could be to impl |
I think this is good for now. I do agree that implementing the trait may ultimately be better but, as you might be aware, @bors r+ |
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#136959 (Simplify switch sources) - rust-lang#137020 (Pass vendored sources from bootstrap to generate-copyright) - rust-lang#137073 (boostrap: skip no_std targets in Std doc step) - rust-lang#137165 (Use `tell` for `<File as Seek>::stream_position`) - rust-lang#137166 (Update default loongarch code model in docs) - rust-lang#137168 (correct comment) - rust-lang#137169 (CI: rfl: move job forward to Linux v6.14-rc3) - rust-lang#137170 (Allow configuring jemalloc per target) - rust-lang#137173 (Subtree update of `rust-analyzer`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#137165 - thaliaarchi:file-tell, r=ChrisDenton Use `tell` for `<File as Seek>::stream_position` Some platforms have a more efficient way to get the current offset of the file than by seeking. For example, Wasi has `fd_tell` and SOLID has `SOLID_FS_Ftell`. Implement `<File as Seek>::stream_position()` in terms of those. I do not use any APIs that were not already used in `std`. Although, the `libc` crate has [`ftell`](https://docs.rs/libc/latest/libc/fn.ftell.html), [`ftello`](https://docs.rs/libc/latest/libc/fn.ftello.html), and [`ftello64`](https://docs.rs/libc/latest/libc/fn.ftello64.html), I do not know platform coverage. It appears that Windows has no `tell`-like API. I have checked that it builds on each relevant platform.
Following rust-lang#137165 (Use `tell` for `<File as Seek>::stream_position`), `tell` is now directly exposed via `stream_position`, making `<File as FileExt>::tell` redundant. Remove it.
…ll, r=alexcrichton Remove `std::os::wasi::fs::FileExt::tell` Following rust-lang#137165 (Use `tell` for `<File as Seek>::stream_position`), `tell` is now directly exposed via `stream_position`, making `<File as FileExt>::tell` redundant. Remove it. `std::os::wasi::fs::FileExt::tell` is currently unstable and tracked in rust-lang#71213. `@rustbot` ping wasi
…ll, r=alexcrichton Remove `std::os::wasi::fs::FileExt::tell` Following rust-lang#137165 (Use `tell` for `<File as Seek>::stream_position`), `tell` is now directly exposed via `stream_position`, making `<File as FileExt>::tell` redundant. Remove it. `std::os::wasi::fs::FileExt::tell` is currently unstable and tracked in rust-lang#71213. ``@rustbot`` ping wasi
Rollup merge of rust-lang#137205 - thaliaarchi:remove-wasi-fileext-tell, r=alexcrichton Remove `std::os::wasi::fs::FileExt::tell` Following rust-lang#137165 (Use `tell` for `<File as Seek>::stream_position`), `tell` is now directly exposed via `stream_position`, making `<File as FileExt>::tell` redundant. Remove it. `std::os::wasi::fs::FileExt::tell` is currently unstable and tracked in rust-lang#71213. ``@rustbot`` ping wasi
Following rust-lang#137165 (Use `tell` for `<File as Seek>::stream_position`), `tell` is now directly exposed via `stream_position`, making `<File as FileExt>::tell` redundant. Remove it.
Following rust-lang#137165 (Use `tell` for `<File as Seek>::stream_position`), `tell` is now directly exposed via `stream_position`, making `<File as FileExt>::tell` redundant. Remove it.
Following rust-lang#137165 (Use `tell` for `<File as Seek>::stream_position`), `tell` is now directly exposed via `stream_position`, making `<File as FileExt>::tell` redundant. Remove it.
Following rust-lang#137165 (Use `tell` for `<File as Seek>::stream_position`), `tell` is now directly exposed via `stream_position`, making `<File as FileExt>::tell` redundant. Remove it.
Following rust-lang#137165 (Use `tell` for `<File as Seek>::stream_position`), `tell` is now directly exposed via `stream_position`, making `<File as FileExt>::tell` redundant. Remove it.
Following rust-lang#137165 (Use `tell` for `<File as Seek>::stream_position`), `tell` is now directly exposed via `stream_position`, making `<File as FileExt>::tell` redundant. Remove it.
Following rust-lang#137165 (Use `tell` for `<File as Seek>::stream_position`), `tell` is now directly exposed via `stream_position`, making `<File as FileExt>::tell` redundant. Remove it.
Following rust-lang#137165 (Use `tell` for `<File as Seek>::stream_position`), `tell` is now directly exposed via `stream_position`, making `<File as FileExt>::tell` redundant. Remove it.
Some platforms have a more efficient way to get the current offset of the file than by seeking. For example, Wasi has
fd_tell
and SOLID hasSOLID_FS_Ftell
. Implement<File as Seek>::stream_position()
in terms of those.I do not use any APIs that were not already used in
std
. Although, thelibc
crate hasftell
,ftello
, andftello64
, I do not know platform coverage. It appears that Windows has notell
-like API.I have checked that it builds on each relevant platform.