Skip to content
Core I/O functionality
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/std/io fix #1 - Windows scattered sync read/write incorrectly implemented Aug 19, 2018
.appveyor.yml
.codecov.yml
.editorconfig std.io library Oct 29, 2017
.gitignore
.travis.yml only build master branch and PRs May 3, 2018
LICENSE.txt
README.md add logo May 11, 2018
dub.sdl
logo.svg add logo May 11, 2018
travis.sh

README.md

Logo

Build Status Build Status codecov

Documentation std.io

IOs are thin, OS-independent abstractions over I/O devices.

size_t write(const scope ubyte[] buffer);
size_t read(scope ubyte[] buffer);

IOs support scatter/gather read/write.

size_t write(const scope ubyte[][] buffers...);
size_t read(scope ubyte[][] buffers...);

IOs are @safe and @nogc.

void read() @safe @nogc
{
    auto f = File(chainPath("tmp", "file.txt"));
    ubyte[128] buf;
    f.read(buf[]);
    // ...
}

IOs use exceptions for error handling.

try
    File("");
catch (IOException e)
{}

IOs use unique ownership and are moveable but not copyable (Use refCounted for shared ownership).

io2 = io.move;
assert(io2.isOpen);
assert(!io.isOpen);

auto rc = refCounted(io2.move);
auto rc2 = rc;
assert(rc.isOpen);
assert(rc2.isOpen);

IOs can be converted to polymorphic interfaces if necessary.

Input input = ioObject(io.move);
You can’t perform that action at this time.