aboutsummaryrefslogtreecommitdiff
path: root/std/io.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-07-25 23:16:13 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-07-30 13:44:36 -0400
commitcc4552733351390aecab9ae900beb822237d6041 (patch)
tree575c7ad933f2ea04c4125704a55dc823839af57e /std/io.zig
parent5d4a02c350a18a70cf1f92f6638b5d26689c16b4 (diff)
downloadzig-cc4552733351390aecab9ae900beb822237d6041.tar.gz
zig-cc4552733351390aecab9ae900beb822237d6041.zip
introduce std.event.fs for async file system functions
only works on linux so far
Diffstat (limited to 'std/io.zig')
-rw-r--r--std/io.zig16
1 files changed, 7 insertions, 9 deletions
diff --git a/std/io.zig b/std/io.zig
index ff73c04f78..49e03a64b2 100644
--- a/std/io.zig
+++ b/std/io.zig
@@ -415,13 +415,12 @@ pub fn PeekStream(comptime buffer_size: usize, comptime InStreamError: type) typ
self.at_end = (read < left);
return pos + read;
}
-
};
}
pub const SliceInStream = struct {
const Self = this;
- pub const Error = error { };
+ pub const Error = error{};
pub const Stream = InStream(Error);
pub stream: Stream,
@@ -481,13 +480,12 @@ pub const SliceOutStream = struct {
assert(self.pos <= self.slice.len);
- const n =
- if (self.pos + bytes.len <= self.slice.len)
- bytes.len
- else
- self.slice.len - self.pos;
+ const n = if (self.pos + bytes.len <= self.slice.len)
+ bytes.len
+ else
+ self.slice.len - self.pos;
- std.mem.copy(u8, self.slice[self.pos..self.pos + n], bytes[0..n]);
+ std.mem.copy(u8, self.slice[self.pos .. self.pos + n], bytes[0..n]);
self.pos += n;
if (n < bytes.len) {
@@ -586,7 +584,7 @@ pub const BufferedAtomicFile = struct {
});
errdefer allocator.destroy(self);
- self.atomic_file = try os.AtomicFile.init(allocator, dest_path, os.default_file_mode);
+ self.atomic_file = try os.AtomicFile.init(allocator, dest_path, os.File.default_mode);
errdefer self.atomic_file.deinit();
self.file_stream = FileOutStream.init(&self.atomic_file.file);