Conversation
|
r? @m-ou-se (rustbot has picked a reviewer for you, use r? to override) |
|
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
This is useful if stream_len is overridden by the Seek implementation of the inner member.
d3592f0 to
811d5b4
Compare
|
Tracking issue: #59359
A comment further downthread suggested moving this method to a new trait so that it's only implemented on types that can return the length atomically. |
|
@the8472 mhh yeah good point. Closing. |
This makes stream_len atomic for File in an attempt to resolve the concerns brought up during the last stabilization attempt from which
stream_lenwas ultimately removed.This gives us atomic
stream_lenfor all of theSeekimplementations in std (or makes us use atomicstream_lenif the underlying construct has such an atomicstream_len):Empty→ already returnsOk(0)since f1cd179Cursor<impl Read>→ already uses atomic operation since c518f2dFile/&File→ now uses atomic operation with this PRBox<impl Seek>→ now uses innerstream_len&mut impl Seek→ now uses innerstream_lenBufReader<impl Seek>→ now uses innerstream_lenBufWriter<impl Seek>→ now uses innerstream_lenThe only non-atomic implementation remaining is the one on the trait itself, which is unfortunate, but I'm not sure if the alternatives to that are better or not.
cc @sfackler @LukasKalbertodt