IssueRaiser

Using std::io::{Read, Write, Cursor} in a nostd environment

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/issues/48331)* I'm surprised there's no ticket for this, so here we go. It isn't possible in nostd to use [std::io::Cursor](https://doc.rust-lang.org/std/io/struct.Cursor.html). That seems to be mostly because it requires std::io::Read, Write, and Seek. However, I'd argue that those traits should also be part of libcore, and only the specific implementations be in libstd. After all, the Read/Write/Seek traits and the Cursor struct don't seem to rely on anything that's part of the stdlib: they don't need allocation, etc... My use-case is, I have to write data into an array, and treating that array in a file would lead to much more idiomatic code. Furthermore it'd allow using crates like byteorder in nostd environment.

Posted by roblabla on Feb 18, 2018, 9:12 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.4,500 issues0 comments

github (Sysadmin)

Using std::io::{Read, Write, Cursor} in a nostd environment

roblablaFeb 18, 2018, 9:12 PM

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/issues/48331)* I'm surprised there's no ticket for this, so here we go. It isn't possible in nostd to use [std::io::Cursor](https://doc.rust-lang.org/std/io/struct.Cursor.html). That seems to be mostly because it requires std::io::Read, Write, and Seek. However, I'd argue that those traits should also be part of libcore, and only the specific implementations be in libstd. After all, the Read/Write/Seek traits and the Cursor struct don't seem to rely on anything that's part of the stdlib: they don't need allocation, etc... My use-case is, I have to write data into an array, and treating that array in a file would lead to much more idiomatic code. Furthermore it'd allow using crates like byteorder in nostd environment.

Comments (0)

No comments yet. Start the discussion.

Comment on this issue