decoder_amd64.go (2301B)
1 // +build amd64,go1.15,!go1.21 2 3 /* 4 * Copyright 2023 ByteDance Inc. 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 package decoder 20 21 import ( 22 `github.com/bytedance/sonic/internal/decoder` 23 ) 24 25 // Decoder is the decoder context object 26 type Decoder = decoder.Decoder 27 28 type MismatchTypeError = decoder.MismatchTypeError 29 30 // Options for decode. 31 type Options = decoder.Options 32 33 const ( 34 OptionUseInt64 Options = decoder.OptionUseInt64 35 OptionUseNumber Options = decoder.OptionUseNumber 36 OptionUseUnicodeErrors Options = decoder.OptionUseUnicodeErrors 37 OptionDisableUnknown Options = decoder.OptionDisableUnknown 38 OptionCopyString Options = decoder.OptionCopyString 39 OptionValidateString Options = decoder.OptionValidateString 40 ) 41 42 // StreamDecoder is the decoder context object for streaming input. 43 type StreamDecoder = decoder.StreamDecoder 44 45 type SyntaxError = decoder.SyntaxError 46 47 var ( 48 // NewDecoder creates a new decoder instance. 49 NewDecoder = decoder.NewDecoder 50 51 // NewStreamDecoder adapts to encoding/json.NewDecoder API. 52 // 53 // NewStreamDecoder returns a new decoder that reads from r. 54 NewStreamDecoder = decoder.NewStreamDecoder 55 56 // Pretouch compiles vt ahead-of-time to avoid JIT compilation on-the-fly, in 57 // order to reduce the first-hit latency. 58 // 59 // Opts are the compile options, for example, "option.WithCompileRecursiveDepth" is 60 // a compile option to set the depth of recursive compile for the nested struct type. 61 Pretouch = decoder.Pretouch 62 63 // Skip skips only one json value, and returns first non-blank character position and its ending position if it is valid. 64 // Otherwise, returns negative error code using start and invalid character position using end 65 Skip = decoder.Skip 66 )