1 //go:build launchdarkly_easyjson 2 // +build launchdarkly_easyjson 3 4 package jwriter 5 6 import ( 7 ejwriter "github.com/mailru/easyjson/jwriter" 8 ) 9 10 // NewWriterFromEasyJSONWriter creates a Writer that produces JSON output through the specified easyjson 11 // jwriter.Writer. 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 marshaling code that is based on the Reader API to be used as 15 // efficiently as possible within other data structures that are being marshaled with easyjson. 16 // Directly using the same Writer that is already being used is more efficient than producing an 17 // intermediate byte slice and then passing that data to the Writer. 18 func NewWriterFromEasyJSONWriter(writer *ejwriter.Writer) Writer { 19 return Writer{ 20 tw: newTokenWriterFromEasyjsonWriter(writer), 21 } 22 } 23