io 0.2.4

Core I/O functionality.


To use this package, run the following command in your project's root directory:

<img src="logo.svg" width="200" alt="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);
Authors:
  • Martin Nowak
Dependencies:
none
Versions:
0.2.4 2019-Nov-07
0.2.3 2019-Oct-26
0.2.2 2018-Aug-19
0.2.1 2018-May-11
0.2.0 2018-May-03
Show all 8 versions
Download Stats:
  • 12 downloads today

  • 60 downloads this week

  • 196 downloads this month

  • 1924 downloads total

Score:
2.1
Short URL:
io.dub.pm