1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

io: mark the mutability requirements of the Writer interface explicitly; swap the io.cp/2 parameter order to be like os.cp/2 (#10091)

This commit is contained in:
Delyan Angelov
2021-05-13 13:06:42 +03:00
committed by GitHub
parent 14b7ce0f04
commit 1086b4ac5e
7 changed files with 24 additions and 10 deletions

View File

@@ -14,7 +14,7 @@ pub fn new_multi_writer(writers ...Writer) Writer {
// MultiWriter writes to all its writers.
pub struct MultiWriter {
pub:
pub mut:
writers []Writer
}
@@ -22,8 +22,8 @@ pub:
// written. If any writer fails to write the full length an error is returned
// and writing to other writers stops. If any writer returns an error the error
// is returned immediately and writing to other writers stops.
pub fn (m MultiWriter) write(buf []byte) ?int {
for w in m.writers {
pub fn (mut m MultiWriter) write(buf []byte) ?int {
for mut w in m.writers {
n := w.write(buf) ?
if n != buf.len {
return error('io: incomplete write to writer of MultiWriter')