rustbot · GitHub

@joshtriplett

@rustbot added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

T-libs

Relevant to the library team, which will review and decide on the PR/issue.

labels

May 26, 2026

Open

3 tasks

@joshtriplett

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.

@joshtriplett

bushrat011899

@rust-bors rust-bors Bot added the S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

label

Jun 16, 2026

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request

Jun 16, 2026
Add `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, 2026

Closed

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))

@rust-bors

Closed

Merged

jhpratt added a commit to jhpratt/rust that referenced this pull request

Jul 5, 2026

jhpratt added a commit to jhpratt/rust that referenced this pull request

Jul 5, 2026

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request

Jul 5, 2026

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request

Jul 5, 2026

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request

Jul 5, 2026

jhpratt added a commit to jhpratt/rust that referenced this pull request

Jul 6, 2026

jhpratt added a commit to jhpratt/rust that referenced this pull request

Jul 6, 2026

rust-timer added a commit that referenced this pull request

Jul 6, 2026

pull Bot pushed a commit to xtqqczze/rust-lang-miri that referenced this pull request

Jul 7, 2026

Read the original on github.com ↗