package gojay

import (
	
	
)

// NewEncoder returns a new StreamEncoder.
// It takes an io.Writer implementation to output data.
// It initiates the done channel returned by Done().
func ( stream) ( io.Writer) *StreamEncoder {
	 := BorrowEncoder()
	return &StreamEncoder{Encoder: , nConsumer: 1, done: make(chan struct{}, 1), mux: &sync.RWMutex{}}
}

// BorrowEncoder borrows a StreamEncoder from the pool.
// It takes an io.Writer implementation to output data.
// It initiates the done channel returned by Done().
//
// If no StreamEncoder is available in the pool, it returns a fresh one
func ( stream) ( io.Writer) *StreamEncoder {
	 := streamEncPool.Get().(*StreamEncoder)
	.w = 
	.Encoder.err = nil
	.done = make(chan struct{}, 1)
	.Encoder.buf = .buf[:0]
	.nConsumer = 1
	.isPooled = 0
	return 
}

func ( stream) ( io.Writer) *StreamEncoder {
	 := streamEncPool.Get().(*StreamEncoder)
	.isPooled = 0
	.w = 
	.Encoder.err = nil
	return 
}