Close marks the reader done. After Close, no further Feed calls have effect. Returns the final accumulated buffer so callers can also json.Unmarshal it into their own typed struct for the canonical non-partial round-trip.
()
| 104 | // json.Unmarshal it into their own typed struct for the canonical |
| 105 | // non-partial round-trip. |
| 106 | func (r *PartialInputReader) Close() string { |
| 107 | r.mu.Lock() |
| 108 | defer r.mu.Unlock() |
| 109 | r.closed = true |
| 110 | r.tryEmitLocked() |
| 111 | return r.buf.String() |
| 112 | } |
| 113 | |
| 114 | // Snapshot returns the current accumulated buffer without mutating |
| 115 | // state. Useful for diagnostics — pull the partial JSON into a log |