Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Why is `Copy` not implemented for `std::io::Cursor`?
The title says most of it, but is there a specific reason why there is no impl<T: Copy> Copy for Cursor<T>
? Taking Cursor<&[u8]>
as an example, it semantically makes total sense to cheaply copy this type around, e.g. if i have functions that read from the cursor's position but the caller still wants to continue from that position.
The best reason I can think of as to why Copy
shouldn't be implemented on the type is for expanding the type with some non-Copy
fields further down the road, but then the idea of a "Cursor" doesn't feel like it should be too heavy anyway.
3 posts - 3 participants
🏷️ rust_feed