| ... | @@ -1505,7 +1505,7 @@ pub const Writer = struct { | ... | @@ -1505,7 +1505,7 @@ pub const Writer = struct { |
| 1505 | sendfile_err: ?SendfileError = null, | 1505 | sendfile_err: ?SendfileError = null, |
| 1506 | copy_file_range_err: ?CopyFileRangeError = null, | 1506 | copy_file_range_err: ?CopyFileRangeError = null, |
| 1507 | fcopyfile_err: ?FcopyfileError = null, | 1507 | fcopyfile_err: ?FcopyfileError = null, |
| 1508 | seek_err: ?SeekError = null, | 1508 | seek_err: ?Writer.SeekError = null, |
| 1509 | interface: std.Io.Writer, | 1509 | interface: std.Io.Writer, |
| 1510 | | 1510 | |
| 1511 | pub const Mode = Reader.Mode; | 1511 | pub const Mode = Reader.Mode; |
| ... | @@ -1527,6 +1527,8 @@ pub const Writer = struct { | ... | @@ -1527,6 +1527,8 @@ pub const Writer = struct { |
| 1527 | Unexpected, | 1527 | Unexpected, |
| 1528 | }; | 1528 | }; |
| 1529 | | 1529 | |
| | 1530 | pub const SeekError = File.SeekError || std.Io.Writer.Error; |
| | 1531 | |
| 1530 | /// Number of slices to store on the stack, when trying to send as many byte | 1532 | /// Number of slices to store on the stack, when trying to send as many byte |
| 1531 | /// vectors through the underlying write calls as possible. | 1533 | /// vectors through the underlying write calls as possible. |
| 1532 | const max_buffers_len = 16; | 1534 | const max_buffers_len = 16; |
| ... | @@ -1570,7 +1572,7 @@ pub const Writer = struct { | ... | @@ -1570,7 +1572,7 @@ pub const Writer = struct { |
| 1570 | .mode = w.mode, | 1572 | .mode = w.mode, |
| 1571 | .pos = w.pos, | 1573 | .pos = w.pos, |
| 1572 | .interface = Reader.initInterface(w.interface.buffer), | 1574 | .interface = Reader.initInterface(w.interface.buffer), |
| 1573 | .seek_err = w.seek_err, | 1575 | .seek_err = null, |
| 1574 | }; | 1576 | }; |
| 1575 | } | 1577 | } |
| 1576 | | 1578 | |
| ... | @@ -2000,7 +2002,8 @@ pub const Writer = struct { | ... | @@ -2000,7 +2002,8 @@ pub const Writer = struct { |
| 2000 | return n; | 2002 | return n; |
| 2001 | } | 2003 | } |
| 2002 | | 2004 | |
| 2003 | pub fn seekTo(w: *Writer, offset: u64) SeekError!void { | 2005 | pub fn seekTo(w: *Writer, offset: u64) Writer.SeekError!void { |
| | 2006 | try w.interface.flush(); |
| 2004 | switch (w.mode) { | 2007 | switch (w.mode) { |
| 2005 | .positional, .positional_reading => { | 2008 | .positional, .positional_reading => { |
| 2006 | w.pos = offset; | 2009 | w.pos = offset; |