From cbf8ec9ae3212e9642385c034fe0b0846af6dfd0 Mon Sep 17 00:00:00 2001
From: Luke Shumaker <lukeshu@lukeshu.com>
Date: Fri, 27 Jan 2023 13:12:35 -0700
Subject: BREAKING CHANGE: reencode: Separate config from state

---
 README.md | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

(limited to 'README.md')

diff --git a/README.md b/README.md
index fcb46fa..108f3dc 100644
--- a/README.md
+++ b/README.md
@@ -41,8 +41,8 @@ those types should decode identically with `lowmemjson`.  Given types
 that encode as desired with `encoding/json`, those types should encode
 identically with `lowmemjson` (assuming an appropriately configured
 `ReEncoder` to match the whitespace-handling and special-character
-escaping; a `ReEncoder` with `Compact=true` and all other settings
-left as zero will match the behavior of `json.Marshal`).
+escaping; a `ReEncoderConfig` with `Compact=true` and all other
+settings left as zero will match the behavior of `json.Marshal`).
 
 For better memory usage:
  - Instead of implementing [`json.Marshaler`][], consider implementing
@@ -95,6 +95,7 @@ types that go with it:
     + `type EncodeMethodError`
 
  3. `type ReEncoder`
+    + `type ReEncoderConfig`
     + `type ReEncodeSyntaxError`
     + `type BackslashEscaper`
       * `type BackslashEscapeMode`
@@ -108,25 +109,13 @@ A `*ReEncoder` handles transforming a JSON stream; this is useful for
 prettifying, minifying, sanitizing, and/or validating JSON.  A
 `*ReEncoder` wraps an `io.Writer`, itself implementing `io.Writer`.
 The most common use of it will be something along the lines of
-
-```go
-out = &ReEncoder{
-	Out: out,
-	// settings here
-}
-```
+`out = lowmemjson.NewReEncoder(out, lowmemjson.ReEncoderConfig{…})`.
 
 An `*Encoder` handles encoding Go values into a JSON stream.
 `*Encoder` doesn't take much care in to making its output nice; so it
 is usually desirable to have the output stream of an `*Encoder` be a `*ReEncoder`; the most
 common use of it will be
-
-```go
-lowmemjson.NewEncoder(&lowmemjson.ReEncoder{
-	Out: out,
-	// settings here
-}).Encode(val)
-```
+`lowmemjson.NewEncoder(lowmemjson.NewReEncoder(out, lowmemjson.ReEncoderConfig{…})).Encode(val)`.
 
 `*Encoder` and `*ReEncoder` both tend to make many small writes; if
 writes are syscalls, you may want to wrap their output in a
-- 
cgit v1.2.3-2-g168b