mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
This commit is contained in:

committed by
GitHub

parent
50820105a1
commit
721328ef58
@ -16,6 +16,17 @@ pub fn new_builder(initial_size int) Builder {
|
||||
return res
|
||||
}
|
||||
|
||||
// reuse_as_plain_u8_array allows using the Builder instance as a plain []u8 return value.
|
||||
// It is useful, when you have accumulated data in the builder, that you want to
|
||||
// pass/access as []u8 later, without copying or freeing the buffer.
|
||||
// NB: you *should NOT use* the string builder instance after calling this method.
|
||||
// Use only the return value after calling this method.
|
||||
[unsafe]
|
||||
pub fn (mut b Builder) reuse_as_plain_u8_array() []u8 {
|
||||
unsafe { b.flags.clear(.noslices) }
|
||||
return *b
|
||||
}
|
||||
|
||||
// write_ptr writes `len` bytes provided byteptr to the accumulated buffer
|
||||
[unsafe]
|
||||
pub fn (mut b Builder) write_ptr(ptr &u8, len int) {
|
||||
|
Reference in New Issue
Block a user