1 //go:build launchdarkly_easyjson 2 // +build launchdarkly_easyjson 3 4 package jreader 5 6 import ( 7 "github.com/mailru/easyjson/jlexer" 8 ) 9 10 // NewReaderFromEasyJSONLexer creates a Reader that consumes JSON input data from the specified easyjson 11 // jlexer.Lexer. 12 // 13 // This function is only available in code that was compiled with the build tag "launchdarkly_easyjson". 14 // Its purpose is to allow custom unmarshaling code that is based on the Reader API to be used as 15 // efficiently as possible within other data structures that are being unmarshaled with easyjson. 16 // Directly using the same Lexer that is already being used is more efficient than asking Lexer to 17 // scan the next object, return it as a byte slice, and then pass that byte slice to NewReader. 18 func NewReaderFromEasyJSONLexer(lexer *jlexer.Lexer) Reader { 19 return Reader{ 20 tr: newTokenReaderFromEasyjsonLexer(lexer), 21 } 22 } 23