added
S-waiting-on-review
labels
May 26, 2026Open
3 tasks
These functions make it easy to read a fixed-size type as little-endian or big-endian. They're trivial wrappers around the combination of `io::Read::read_array` and `T::from_le_bytes`/`T::from_be_bytes`. The implementation uses a sealed trait `FromEndianBytes`. That trait is currently in `std` and accepts a `&mut io::Read`. Once we can use associated consts in the types of method parameters, we can change this trait to have `from_le_bytes` and `from_be_bytes` methods, move it to `core`, and make it public.
rust-bors
Bot
added
the
S-waiting-on-bors
label
Jun 16, 2026JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request
Jun 16, 2026Add `io::Read::read_le` and `io::Read::read_be` These functions make it easy to read a fixed-size type as little-endian or big-endian. They're trivial wrappers around the combination of `io::Read::read_array` and `T::from_le_bytes`/`T::from_be_bytes`. The implementation uses a sealed trait `FromEndianBytes`. That trait is currently in `std` and accepts a `&mut io::Read`. Once we can use associated consts in the types of method parameters, we can change this trait to have `from_le_bytes` and `from_be_bytes` methods, move it to `core`, and make it public. --- As discussed at RustWeek.
This was referenced
Jun 16, 2026Closed
Merged
rust-bors Bot pushed a commit that referenced this pull request
Jun 16, 2026…uwer Rollup of 13 pull requests Successful merges: - #156538 (Refactor `AliasTy`. `AliasTerm` & `UnevaluatedConst` to use `Alias`) - #156807 (Add `T: PartialEq` bounds to derived `StructuralPartialEq` impls.) - #156950 (Staticlib rename internal symbols) - #156983 (Add `io::Read::read_le` and `io::Read::read_be`) - #157306 (tests: codegen-llvm: Expect the new mangling scheme in bpf-abi-indirect-return) - #157702 (Add expansion info to implied bounds) - #155616 (constify `TryFrom<Vec>` for array) - #156226 (diagnostics: point to coroutine body on higher-ranked auto trait errors) - #157870 (std: sys: solid: clamp connect_timeout tv_sec instead of truncating) - #157952 (Configure Renovate for GitHub Actions) - #157953 (fix(rustc_codegen_ssa): Use cg_operand for Freeze check) - #157958 (doc: Document `-Zlint-rust-version`) - #157974 (Rename `errors.rs` file to `diagnostics.rs` (11/N))
Closed
Merged
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request
Jul 5, 2026JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request
Jul 5, 2026JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request
Jul 5, 2026