package gojay

import (
	
	
)

var encPool = sync.Pool{
	New: func() interface{} {
		return NewEncoder(nil)
	},
}

var streamEncPool = sync.Pool{
	New: func() interface{} {
		return Stream.NewEncoder(nil)
	},
}

func init() {
	for  := 0;  < 32; ++ {
		encPool.Put(NewEncoder(nil))
	}
	for  := 0;  < 32; ++ {
		streamEncPool.Put(Stream.NewEncoder(nil))
	}
}

// NewEncoder returns a new encoder or borrows one from the pool
func ( io.Writer) *Encoder {
	return &Encoder{w: }
}

// BorrowEncoder borrows an Encoder from the pool.
func ( io.Writer) *Encoder {
	 := encPool.Get().(*Encoder)
	.w = 
	.buf = .buf[:0]
	.isPooled = 0
	.err = nil
	.hasKeys = false
	.keys = nil
	return 
}

// Release sends back a Encoder to the pool.
func ( *Encoder) () {
	.isPooled = 1
	encPool.Put()
}