mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
strings: rename Builder.write_b() to Builder.write_byte(), add deprecation (#13313)
This commit is contained in:
@@ -49,10 +49,17 @@ pub fn (mut b Builder) write_runes(runes []rune) {
|
||||
}
|
||||
|
||||
// write_b appends a single `data` byte to the accumulated buffer
|
||||
[deprecated: 'Use write_byte() instead']
|
||||
[deprecated_after: '2022-02-11']
|
||||
pub fn (mut b Builder) write_b(data byte) {
|
||||
b << data
|
||||
}
|
||||
|
||||
// write_byte appends a single `data` byte to the accumulated buffer
|
||||
pub fn (mut b Builder) write_byte(data byte) {
|
||||
b << data
|
||||
}
|
||||
|
||||
// write implements the Writer interface
|
||||
pub fn (mut b Builder) write(data []byte) ?int {
|
||||
if data.len == 0 {
|
||||
|
@@ -18,10 +18,15 @@ pub fn new_builder(initial_size int) Builder {
|
||||
return []byte{cap: initial_size}
|
||||
}
|
||||
|
||||
[deprecated: 'Use write_byte() instead']
|
||||
pub fn (mut b Builder) write_b(data byte) {
|
||||
b << data
|
||||
}
|
||||
|
||||
pub fn (mut b Builder) write_byte(data byte) {
|
||||
b << data
|
||||
}
|
||||
|
||||
pub fn (mut b Builder) write(data []byte) ?int {
|
||||
if data.len == 0 {
|
||||
return 0
|
||||
|
@@ -65,7 +65,7 @@ fn test_byte_write() {
|
||||
temp_str := 'byte testing'
|
||||
mut count := 0
|
||||
for word in temp_str {
|
||||
sb.write_b(word)
|
||||
sb.write_byte(word)
|
||||
count++
|
||||
assert count == sb.len
|
||||
}
|
||||
|
@@ -65,7 +65,7 @@ fn test_byte_write() {
|
||||
temp_str := 'byte testing'
|
||||
mut count := 0
|
||||
for word in temp_str {
|
||||
sb.write_b(word)
|
||||
sb.write_byte(word)
|
||||
count++
|
||||
assert count == sb.len
|
||||
}
|
||||
|
Reference in New Issue
Block a user