diff options
Diffstat (limited to 'encode.go')
-rw-r--r-- | encode.go | 15 |
1 files changed, 1 insertions, 14 deletions
@@ -1,4 +1,4 @@ -// Copyright (C) 2022 Luke Shumaker <lukeshu@lukeshu.com> +// Copyright (C) 2022-2023 Luke Shumaker <lukeshu@lukeshu.com> // // SPDX-License-Identifier: GPL-2.0-or-later @@ -82,19 +82,6 @@ func (enc *Encoder) Encode(obj any) (err error) { return nil } -// Encode encodes a value to w. -// -// If w is an *ReEncoder, then the inner backslash-escaping of -// double-encoded ",string" tagged string values obeys the -// *ReEncoder's BackslashEscape policy. -// -// Does not write a trailing newline or other whitespace; if you will -// be encoding multiple values to w, then you should instead use an -// *Encoder object, as some JSON values need whitespace between them. -func Encode(w io.Writer, obj any) (err error) { - return NewEncoder(w).Encode(obj) -} - var ( encodableType = reflect.TypeOf((*Encodable)(nil)).Elem() jsonMarshalerType = reflect.TypeOf((*json.Marshaler)(nil)).Elem() |