package jsoniter

import (
	
)

// IteratorPool a thread safe pool of iterators with same configuration
type IteratorPool interface {
	BorrowIterator(data []byte) *Iterator
	ReturnIterator(iter *Iterator)
}

// StreamPool a thread safe pool of streams with same configuration
type StreamPool interface {
	BorrowStream(writer io.Writer) *Stream
	ReturnStream(stream *Stream)
}

func ( *frozenConfig) ( io.Writer) *Stream {
	 := .streamPool.Get().(*Stream)
	.Reset()
	return 
}

func ( *frozenConfig) ( *Stream) {
	.out = nil
	.Error = nil
	.Attachment = nil
	.streamPool.Put()
}

func ( *frozenConfig) ( []byte) *Iterator {
	 := .iteratorPool.Get().(*Iterator)
	.ResetBytes()
	return 
}

func ( *frozenConfig) ( *Iterator) {
	.Error = nil
	.Attachment = nil
	.iteratorPool.Put()
}