Skip to content

Consider moving parts of libstd::io to libcore #15568

Closed
@erickt

Description

@erickt

A decent chunk of libstd::io looks like it could be moved over to libcore, which would be really handy for low level systems. While this would ultimately be convenient, there'd be some transitional pain making this move. The biggest source would be that'd we'd have to parameterize the Reader/Writer types on the error. We'd also have to convert a couple of the default methods over into generic functions to make this work.

Here are the things that I believe could be moved over:

  • Without modification:
    • RefReader, Writer, RefWriter, Stream, Buffer, Seek, Listener, Acceptor, IncomingConnection
    • All of std::io::extensions
    • std::io::mem::BufWriter and std::io::mem::BufReader
    • std::io::util::LimitReader, std::io::util::NullWriter, std::io::util::ZeroReader, std::io::util::NullReader, std::io::util::ChainedReader, std::io::util::TeeReader, std::io::util::IterReader.

With some modification:

  • Reader and Buffer with these methods converted into generic functions:
    • Reader::push, Reader::push_at_least, Reader::read_exact, Reader::read_to_end, and Reader::read_to_string, Buffer::read_line, Buffer::read_until
  • We could also move FileMode, FileAccess, FileType, FileStat, and UnstableFileStat, but it might be better to leave os-specific stuff in libstd.

There are a couple that we could probably rewrite to not use things like Vec, such as std::io::util::MultiWriter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions