github.com/bytedance/sonic@v1.11.7-0.20240517092252-d2edb31b167b/decoder/decoder_amd64.go (about)

     1  // +build amd64,go1.16,!go1.23
     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  // SyntaxError represents json syntax error
    29  type SyntaxError = decoder.SyntaxError
    30  
    31  // MismatchTypeError represents dismatching between json and object
    32  type MismatchTypeError = decoder.MismatchTypeError
    33  
    34  // Options for decode.
    35  type Options = decoder.Options
    36  
    37  const (
    38      OptionUseInt64         Options = decoder.OptionUseInt64
    39      OptionUseNumber        Options = decoder.OptionUseNumber
    40      OptionUseUnicodeErrors Options = decoder.OptionUseUnicodeErrors
    41      OptionDisableUnknown   Options = decoder.OptionDisableUnknown
    42      OptionCopyString       Options = decoder.OptionCopyString
    43      OptionValidateString   Options = decoder.OptionValidateString
    44  )
    45  
    46  // StreamDecoder is the decoder context object for streaming input.
    47  type StreamDecoder = decoder.StreamDecoder
    48  
    49  var (
    50      // NewDecoder creates a new decoder instance.
    51      NewDecoder = decoder.NewDecoder
    52  
    53      // NewStreamDecoder adapts to encoding/json.NewDecoder API.
    54      //
    55      // NewStreamDecoder returns a new decoder that reads from r.
    56      NewStreamDecoder = decoder.NewStreamDecoder
    57  
    58      // Pretouch compiles vt ahead-of-time to avoid JIT compilation on-the-fly, in
    59      // order to reduce the first-hit latency.
    60      //
    61      // Opts are the compile options, for example, "option.WithCompileRecursiveDepth" is
    62      // a compile option to set the depth of recursive compile for the nested struct type.
    63      Pretouch = decoder.Pretouch
    64      
    65      // Skip skips only one json value, and returns first non-blank character position and its ending position if it is valid.
    66      // Otherwise, returns negative error code using start and invalid character position using end
    67      Skip = decoder.Skip
    68  )