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

strings: make builder implement io.Writer (#8914)

This commit is contained in:
zakuro
2021-02-23 16:42:48 +09:00
committed by GitHub
parent 5674d46965
commit c113abe1a4
2 changed files with 13 additions and 11 deletions

View File

@ -37,9 +37,11 @@ pub fn (mut b Builder) write_b(data byte) {
b.len++
}
[deprecated: 'write(string) will be changed to write([]byte)']
pub fn (mut b Builder) write(s string) {
b.write_string(s)
// write implements the Writer interface
pub fn (mut b Builder) write(data []byte) ?int {
b.buf << data
b.len += data.len
return data.len
}
// write appends the string `s` to the buffer