| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Data.Conduit.Blaze
Contents
Description
Convert a stream of blaze-builder Builders into a stream of ByteStrings.
Adapted from blaze-builder-enumerator, written by myself and Simon Meier.
Note that the functions here can work in any monad built on top of IO or
ST.
Since 1.1.7.0, the functions here call their counterparts in
Data.Conduit.ByteString.Builder, which work with both
Builder and blaze-builder 0.3's
Builder.
- builderToByteString :: (MonadBase base m, PrimMonad base) => Conduit Builder m ByteString
- unsafeBuilderToByteString :: (MonadBase base m, PrimMonad base) => IO Buffer -> Conduit Builder m ByteString
- builderToByteStringWith :: (MonadBase base m, PrimMonad base) => BufferAllocStrategy -> Conduit Builder m ByteString
- builderToByteStringFlush :: (MonadBase base m, PrimMonad base) => Conduit (Flush Builder) m (Flush ByteString)
- builderToByteStringWithFlush :: (MonadBase base m, PrimMonad base) => BufferAllocStrategy -> Conduit (Flush Builder) m (Flush ByteString)
- 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
Conduits from builders to bytestrings
builderToByteString :: (MonadBase base m, PrimMonad base) => Conduit Builder m ByteString #
Incrementally execute builders and pass on the filled chunks as bytestrings.
unsafeBuilderToByteString :: (MonadBase base m, PrimMonad base) => IO Buffer -> Conduit Builder m ByteString #
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 conduit yields bytestrings that are NOT referentially transparent. Their content will be overwritten as soon as control is returned from the inner sink!
builderToByteStringWith :: (MonadBase base m, PrimMonad base) => BufferAllocStrategy -> Conduit Builder m ByteString #
A conduit that incrementally executes builders and passes on the filled chunks as bytestrings to an inner sink.
INV: All bytestrings passed to the inner sink are non-empty.
Flush
builderToByteStringFlush :: (MonadBase base m, PrimMonad base) => Conduit (Flush Builder) m (Flush ByteString) #
Since 0.0.2
builderToByteStringWithFlush :: (MonadBase base m, PrimMonad base) => BufferAllocStrategy -> Conduit (Flush Builder) m (Flush ByteString) #
Since 0.0.2
Buffers
Status information
bufferSize :: Buffer -> Int #
Creation and modification
allocBuffer :: Int -> IO Buffer #
reuseBuffer :: Buffer -> Buffer #
Conversion to bytestings
unsafeFreezeBuffer :: Buffer -> ByteString #