()
| 64 | } |
| 65 | |
| 66 | func ExampleSerializeBuffer() { |
| 67 | b := NewSerializeBuffer() |
| 68 | fmt.Println("1:", b.Bytes()) |
| 69 | bytes, _ := b.PrependBytes(3) |
| 70 | copy(bytes, []byte{1, 2, 3}) |
| 71 | fmt.Println("2:", b.Bytes()) |
| 72 | bytes, _ = b.AppendBytes(2) |
| 73 | copy(bytes, []byte{4, 5}) |
| 74 | fmt.Println("3:", b.Bytes()) |
| 75 | bytes, _ = b.PrependBytes(1) |
| 76 | copy(bytes, []byte{0}) |
| 77 | fmt.Println("4:", b.Bytes()) |
| 78 | bytes, _ = b.AppendBytes(3) |
| 79 | copy(bytes, []byte{6, 7, 8}) |
| 80 | fmt.Println("5:", b.Bytes()) |
| 81 | b.Clear() |
| 82 | fmt.Println("6:", b.Bytes()) |
| 83 | bytes, _ = b.PrependBytes(2) |
| 84 | copy(bytes, []byte{9, 9}) |
| 85 | fmt.Println("7:", b.Bytes()) |
| 86 | // Output: |
| 87 | // 1: [] |
| 88 | // 2: [1 2 3] |
| 89 | // 3: [1 2 3 4 5] |
| 90 | // 4: [0 1 2 3 4 5] |
| 91 | // 5: [0 1 2 3 4 5 6 7 8] |
| 92 | // 6: [] |
| 93 | // 7: [9 9] |
| 94 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…