async-rs / async-rs/async-std

Stream::last() has hidden requirement that the item type be Copy

Open
#753 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
4.1k
Forks
339
PR merge metrics
No merged PRs in 30d

Description

The `Future` type returned by `Stream::last()` requires that the item type be `Copy` but this is not documented anywhere: https://github.com/async-rs/async-std/blob/b446cd023084a157b8a531cff65b8df37750be58/src/stream/stream/last.rs#L25-L29

This looks to be an implementation mistake because copying `this.last` should not be necessary here and `this.last.take()` can be used instead: https://github.com/async-rs/async-std/blob/b446cd023084a157b8a531cff65b8df37750be58/src/stream/stream/last.rs#L42

cc https://github.com/launchbadge/sqlx/issues/277

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.