Skip to content

Commit

Permalink
readme: update
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado committed Oct 31, 2021
1 parent 0b1fb6a commit 9ec31cc
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ to be drop-in replacement for standard `encoding/json`. Removing such constrains
simplified implementation and reduced scope, allowing to focus on json stream processing.

## Capture

The `Decoder.Capture` method allows to unread everything is read in callback.
This is useful for multi-pass parsing:
This is useful for multi-pass parsing.
```go
func TestDecoder_Capture(t *testing.T) {
d := DecodeStr(`["foo", "bar", "baz"]`)
Expand All @@ -45,9 +44,9 @@ func TestDecoder_Capture(t *testing.T) {
}
```

## ObjectBytes
## ObjBytes

The `Decoder.ObjectBytes` method tries not to allocate memory for keys, reusing existing buffer:
The `Decoder.ObjBytes` method tries not to allocate memory for keys, reusing existing buffer.
```go
d := DecodeStr(`{"id":1,"randomNumber":10}`)
d.ObjBytes(func(d *Decoder, key []byte) error {
Expand Down

0 comments on commit 9ec31cc

Please sign in to comment.