Copyright | (c) 2010 Simon Meier |
---|---|
License | BSD3 |
Maintainer | Simon Meier <iridcode@gmail.com> |
Stability | Experimental |
Portability | Tested on GHC only |
Safe Haskell | None |
Language | Haskell98 |
Blaze.ByteString.Builder.Enumerator
Contents
Description
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 Buffer
code is likely to move/change in order to
reconciliate it with the rest of the blaze-builder library.
- 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
- builderToByteString :: MonadIO m => Enumeratee Builder ByteString m a
- unsafeBuilderToByteString :: MonadIO m => IO Buffer -> Enumeratee Builder ByteString m a
- builderToByteStringWith :: MonadIO m => BufferAllocStrategy -> Enumeratee Builder ByteString m a
Buffers
Status information
bufferSize :: Buffer -> Int #
Creation and modification
allocBuffer :: Int -> IO Buffer #
reuseBuffer :: Buffer -> Buffer #
Conversion to bytestings
unsafeFreezeBuffer :: Buffer -> ByteString #
Buffer allocation strategies
Enumeratees from builders to bytestrings
builderToByteString :: MonadIO m => Enumeratee Builder ByteString m a #
Incrementally execute builders and pass on the filled chunks as bytestrings.
unsafeBuilderToByteString :: MonadIO m => IO Buffer -> 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!
builderToByteStringWith :: MonadIO m => BufferAllocStrategy -> 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.