EncodeBool writes a varint-encoded boolean value to the buffer preceded by the varint-encoded tag key.
(tag int, v bool)
| 23 | |
| 24 | // EncodeBool writes a varint-encoded boolean value to the buffer preceded by the varint-encoded tag key. |
| 25 | func (e *Encoder) EncodeBool(tag int, v bool) { |
| 26 | e.offset += EncodeTag(e.p[e.offset:], tag, WireTypeVarint) |
| 27 | if v { |
| 28 | e.p[e.offset] = 1 |
| 29 | } else { |
| 30 | e.p[e.offset] = 0 |
| 31 | } |
| 32 | e.offset++ |
| 33 | } |
| 34 | |
| 35 | // EncodeString writes a length-delimited string value to the buffer preceded by the varint-encoded tag key. |
| 36 | func (e *Encoder) EncodeString(tag int, s string) { |