-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Enumeratees for the incremental conversion of builders to
--   bytestrings.
--   
--   This package integrates the builders from the blaze-builder package
--   with the enumerator package. It provides infrastructure and
--   enumeratees for incrementally executing builders and pass the filled
--   chunks to a bytestring iteratee.
@package blaze-builder-enumerator
@version 0.2.1.0


-- | Infrastructure and enumeratees for the incremental execution of
--   builders and passing on of the filled chunks as bytestrings to an
--   inner iteratee.
--   
--   Note that the <tt>Buffer</tt> code is likely to move/change in order
--   to reconciliate it with the rest of the blaze-builder library.
module Blaze.ByteString.Builder.Enumerator
data Buffer :: *
freeSize :: Buffer -> Int
sliceSize :: Buffer -> Int
bufferSize :: Buffer -> Int
allocBuffer :: Int -> IO Buffer
reuseBuffer :: Buffer -> Buffer
nextSlice :: Int -> Buffer -> Maybe Buffer
unsafeFreezeBuffer :: Buffer -> ByteString
unsafeFreezeNonEmptyBuffer :: Buffer -> Maybe ByteString
type BufferAllocStrategy = (IO Buffer, Int -> Buffer -> IO (IO Buffer))
allNewBuffersStrategy :: Int -> BufferAllocStrategy
reuseBufferStrategy :: IO Buffer -> BufferAllocStrategy

-- | Incrementally execute builders and pass on the filled chunks as
--   bytestrings.
builderToByteString :: MonadIO m => Enumeratee Builder ByteString m a

-- | Incrementally execute builders on the given buffer and pass on the
--   filled chunks as bytestrings. Note that, if the given buffer is too
--   small for the execution of a build step, a larger one will be
--   allocated.
--   
--   WARNING: This enumeratee yields bytestrings that are NOT referentially
--   transparent. Their content will be overwritten as soon as control is
--   returned from the inner iteratee!
unsafeBuilderToByteString :: MonadIO m => IO Buffer -> Enumeratee Builder ByteString m a

-- | An enumeratee that incrementally executes builders and passes on the
--   filled chunks as bytestrings to an inner iteratee.
--   
--   INV: All bytestrings passed to the inner iteratee are non-empty.
builderToByteStringWith :: MonadIO m => BufferAllocStrategy -> Enumeratee Builder ByteString m a
