WriteRune emits a single rune.
(s rune)
| 169 | |
| 170 | // WriteRune emits a single rune. |
| 171 | func (b *Buffer) WriteRune(s rune) error { |
| 172 | b.startWrite() |
| 173 | l := utf8.RuneLen(s) |
| 174 | m, ok := b.tryGrowByReslice(l) |
| 175 | if !ok { |
| 176 | m = b.grow(l) |
| 177 | } |
| 178 | _ = utf8.EncodeRune(b.buf[m:], s) |
| 179 | return nil |
| 180 | } |
| 181 | |
| 182 | // finalize ensures that all the buffer is properly |
| 183 | // marked. |