Safe Haskell | None |
---|---|
Language | Haskell98 |
Convert a stream of blaze-builder Builder
s into a stream of ByteString
s.
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
.
- 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 Source
Incrementally execute builders and pass on the filled chunks as bytestrings.
unsafeBuilderToByteString :: (MonadBase base m, PrimMonad base) => IO Buffer -> Conduit Builder m ByteString Source
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 Source
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) Source
Since 0.0.2
builderToByteStringWithFlush :: (MonadBase base m, PrimMonad base) => BufferAllocStrategy -> Conduit (Flush Builder) m (Flush ByteString) Source
Since 0.0.2
Buffers
data Buffer :: *
Status information
bufferSize :: Buffer -> Int
Creation and modification
allocBuffer :: Int -> IO Buffer
reuseBuffer :: Buffer -> Buffer