/usr/share/doc/libghc-conduit-extra-doc/html/Data-Conduit-ByteString-Builder.html is in libghc-conduit-extra-doc 1.1.17-1build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Data.Conduit.ByteString.Builder</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="file:///usr/share/javascript/mathjax/MathJax.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Data-Conduit-ByteString-Builder.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-Conduit-ByteString-Builder.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">conduit-extra-1.1.17: Batteries included conduit: adapters for common libraries.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Data.Conduit.ByteString.Builder</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Conduits from builders to bytestrings</a><ul><li><a href="#g:2">Flush</a></li></ul></li><li><a href="#g:3">Buffers</a><ul><li><a href="#g:4">Status information</a></li><li><a href="#g:5">Creation and modification</a></li><li><a href="#g:6">Conversion to bytestings</a></li></ul></li><li><a href="#g:7">Buffer allocation strategies</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Convert a stream of blaze-builder <code>Builder</code>s into a stream of <code>ByteString</code>s.</p><p>Works with both blaze-builder < 0.4's <code>Builder</code>s and
<code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Builder.html#v:Builder">Builder</a></code>.</p><p>Adapted from blaze-builder-enumerator, written by myself and Simon Meier.</p><p>Note that the functions here can work in any monad built on top of <code>IO</code> or
<code>ST</code>.</p><p>Since 1.1.7.0</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:builderToByteString">builderToByteString</a> :: (<a href="file:///usr/share/doc/libghc-transformers-base-doc/html/Control-Monad-Base.html#t:MonadBase">MonadBase</a> base m, <a href="file:///usr/share/doc/libghc-primitive-doc/html/Control-Monad-Primitive.html#t:PrimMonad">PrimMonad</a> base, <a href="file:///usr/share/doc/libghc-streaming-commons-doc/html/Data-Streaming-ByteString-Builder-Class.html#t:StreamingBuilder">StreamingBuilder</a> b) => <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Conduit">Conduit</a> b m <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:unsafeBuilderToByteString">unsafeBuilderToByteString</a> :: (<a href="file:///usr/share/doc/libghc-transformers-base-doc/html/Control-Monad-Base.html#t:MonadBase">MonadBase</a> base m, <a href="file:///usr/share/doc/libghc-primitive-doc/html/Control-Monad-Primitive.html#t:PrimMonad">PrimMonad</a> base, <a href="file:///usr/share/doc/libghc-streaming-commons-doc/html/Data-Streaming-ByteString-Builder-Class.html#t:StreamingBuilder">StreamingBuilder</a> b) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/System-IO.html#t:IO">IO</a> <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a> -> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Conduit">Conduit</a> b m <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:builderToByteStringWith">builderToByteStringWith</a> :: (<a href="file:///usr/share/doc/libghc-transformers-base-doc/html/Control-Monad-Base.html#t:MonadBase">MonadBase</a> base m, <a href="file:///usr/share/doc/libghc-primitive-doc/html/Control-Monad-Primitive.html#t:PrimMonad">PrimMonad</a> base, <a href="file:///usr/share/doc/libghc-streaming-commons-doc/html/Data-Streaming-ByteString-Builder-Class.html#t:StreamingBuilder">StreamingBuilder</a> b) => <a href="Data-Conduit-ByteString-Builder.html#t:BufferAllocStrategy">BufferAllocStrategy</a> -> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Conduit">Conduit</a> b m <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:builderToByteStringFlush">builderToByteStringFlush</a> :: (<a href="file:///usr/share/doc/libghc-transformers-base-doc/html/Control-Monad-Base.html#t:MonadBase">MonadBase</a> base m, <a href="file:///usr/share/doc/libghc-primitive-doc/html/Control-Monad-Primitive.html#t:PrimMonad">PrimMonad</a> base, <a href="file:///usr/share/doc/libghc-streaming-commons-doc/html/Data-Streaming-ByteString-Builder-Class.html#t:StreamingBuilder">StreamingBuilder</a> b) => <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Conduit">Conduit</a> (<a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Flush">Flush</a> b) m (<a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Flush">Flush</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a>)</li><li class="src short"><a href="#v:builderToByteStringWithFlush">builderToByteStringWithFlush</a> :: (<a href="file:///usr/share/doc/libghc-transformers-base-doc/html/Control-Monad-Base.html#t:MonadBase">MonadBase</a> base m, <a href="file:///usr/share/doc/libghc-primitive-doc/html/Control-Monad-Primitive.html#t:PrimMonad">PrimMonad</a> base, <a href="file:///usr/share/doc/libghc-streaming-commons-doc/html/Data-Streaming-ByteString-Builder-Class.html#t:StreamingBuilder">StreamingBuilder</a> b) => <a href="Data-Conduit-ByteString-Builder.html#t:BufferAllocStrategy">BufferAllocStrategy</a> -> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Conduit">Conduit</a> (<a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Flush">Flush</a> b) m (<a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Flush">Flush</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a>)</li><li class="src short"><span class="keyword">data</span> <a href="#t:Buffer">Buffer</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a></li><li class="src short"><a href="#v:freeSize">freeSize</a> :: <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:sliceSize">sliceSize</a> :: <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:bufferSize">bufferSize</a> :: <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:allocBuffer">allocBuffer</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/System-IO.html#t:IO">IO</a> <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a></li><li class="src short"><a href="#v:reuseBuffer">reuseBuffer</a> :: <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a> -> <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a></li><li class="src short"><a href="#v:nextSlice">nextSlice</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a></li><li class="src short"><a href="#v:unsafeFreezeBuffer">unsafeFreezeBuffer</a> :: <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:unsafeFreezeNonEmptyBuffer">unsafeFreezeNonEmptyBuffer</a> :: <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><span class="keyword">type</span> <a href="#t:BufferAllocStrategy">BufferAllocStrategy</a> = (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/System-IO.html#t:IO">IO</a> <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a>, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/System-IO.html#t:IO">IO</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/System-IO.html#t:IO">IO</a> <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a>))</li><li class="src short"><a href="#v:allNewBuffersStrategy">allNewBuffersStrategy</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Conduit-ByteString-Builder.html#t:BufferAllocStrategy">BufferAllocStrategy</a></li><li class="src short"><a href="#v:reuseBufferStrategy">reuseBufferStrategy</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/System-IO.html#t:IO">IO</a> <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a> -> <a href="Data-Conduit-ByteString-Builder.html#t:BufferAllocStrategy">BufferAllocStrategy</a></li></ul></div><div id="interface"><h1 id="g:1">Conduits from builders to bytestrings</h1><div class="top"><p class="src"><a id="v:builderToByteString" class="def">builderToByteString</a> :: (<a href="file:///usr/share/doc/libghc-transformers-base-doc/html/Control-Monad-Base.html#t:MonadBase">MonadBase</a> base m, <a href="file:///usr/share/doc/libghc-primitive-doc/html/Control-Monad-Primitive.html#t:PrimMonad">PrimMonad</a> base, <a href="file:///usr/share/doc/libghc-streaming-commons-doc/html/Data-Streaming-ByteString-Builder-Class.html#t:StreamingBuilder">StreamingBuilder</a> b) => <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Conduit">Conduit</a> b m <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Data-Conduit-ByteString-Builder.html#builderToByteString" class="link">Source</a> <a href="#v:builderToByteString" class="selflink">#</a></p><div class="doc"><p>Incrementally execute builders and pass on the filled chunks as
bytestrings.</p></div></div><div class="top"><p class="src"><a id="v:unsafeBuilderToByteString" class="def">unsafeBuilderToByteString</a> :: (<a href="file:///usr/share/doc/libghc-transformers-base-doc/html/Control-Monad-Base.html#t:MonadBase">MonadBase</a> base m, <a href="file:///usr/share/doc/libghc-primitive-doc/html/Control-Monad-Primitive.html#t:PrimMonad">PrimMonad</a> base, <a href="file:///usr/share/doc/libghc-streaming-commons-doc/html/Data-Streaming-ByteString-Builder-Class.html#t:StreamingBuilder">StreamingBuilder</a> b) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/System-IO.html#t:IO">IO</a> <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a> -> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Conduit">Conduit</a> b m <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Data-Conduit-ByteString-Builder.html#unsafeBuilderToByteString" class="link">Source</a> <a href="#v:unsafeBuilderToByteString" class="selflink">#</a></p><div class="doc"><p>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.</p><p>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!</p></div></div><div class="top"><p class="src"><a id="v:builderToByteStringWith" class="def">builderToByteStringWith</a> :: (<a href="file:///usr/share/doc/libghc-transformers-base-doc/html/Control-Monad-Base.html#t:MonadBase">MonadBase</a> base m, <a href="file:///usr/share/doc/libghc-primitive-doc/html/Control-Monad-Primitive.html#t:PrimMonad">PrimMonad</a> base, <a href="file:///usr/share/doc/libghc-streaming-commons-doc/html/Data-Streaming-ByteString-Builder-Class.html#t:StreamingBuilder">StreamingBuilder</a> b) => <a href="Data-Conduit-ByteString-Builder.html#t:BufferAllocStrategy">BufferAllocStrategy</a> -> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Conduit">Conduit</a> b m <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Data-Conduit-ByteString-Builder.html#builderToByteStringWith" class="link">Source</a> <a href="#v:builderToByteStringWith" class="selflink">#</a></p><div class="doc"><p>A conduit that incrementally executes builders and passes on the
filled chunks as bytestrings to an inner sink.</p><p>INV: All bytestrings passed to the inner sink are non-empty.</p></div></div><h2 id="g:2">Flush</h2><div class="top"><p class="src"><a id="v:builderToByteStringFlush" class="def">builderToByteStringFlush</a> :: (<a href="file:///usr/share/doc/libghc-transformers-base-doc/html/Control-Monad-Base.html#t:MonadBase">MonadBase</a> base m, <a href="file:///usr/share/doc/libghc-primitive-doc/html/Control-Monad-Primitive.html#t:PrimMonad">PrimMonad</a> base, <a href="file:///usr/share/doc/libghc-streaming-commons-doc/html/Data-Streaming-ByteString-Builder-Class.html#t:StreamingBuilder">StreamingBuilder</a> b) => <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Conduit">Conduit</a> (<a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Flush">Flush</a> b) m (<a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Flush">Flush</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a>) <a href="src/Data-Conduit-ByteString-Builder.html#builderToByteStringFlush" class="link">Source</a> <a href="#v:builderToByteStringFlush" class="selflink">#</a></p><div class="doc"><p>Since 0.0.2</p></div></div><div class="top"><p class="src"><a id="v:builderToByteStringWithFlush" class="def">builderToByteStringWithFlush</a> :: (<a href="file:///usr/share/doc/libghc-transformers-base-doc/html/Control-Monad-Base.html#t:MonadBase">MonadBase</a> base m, <a href="file:///usr/share/doc/libghc-primitive-doc/html/Control-Monad-Primitive.html#t:PrimMonad">PrimMonad</a> base, <a href="file:///usr/share/doc/libghc-streaming-commons-doc/html/Data-Streaming-ByteString-Builder-Class.html#t:StreamingBuilder">StreamingBuilder</a> b) => <a href="Data-Conduit-ByteString-Builder.html#t:BufferAllocStrategy">BufferAllocStrategy</a> -> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Conduit">Conduit</a> (<a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Flush">Flush</a> b) m (<a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Flush">Flush</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a>) <a href="src/Data-Conduit-ByteString-Builder.html#builderToByteStringWithFlush" class="link">Source</a> <a href="#v:builderToByteStringWithFlush" class="selflink">#</a></p><div class="doc"><p>Since 0.0.2</p></div></div><h1 id="g:3">Buffers</h1><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:Buffer" class="def">Buffer</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a> <a href="#t:Buffer" class="selflink">#</a></p><div class="doc"><p>A buffer <code>Buffer fpbuf p0 op ope</code> describes a buffer with the underlying
byte array <code>fpbuf..ope</code>, the currently written slice <code>p0..op</code> and the free
space <code>op..ope</code>.</p><p>Since 0.1.10.0</p></div></div><h2 id="g:4">Status information</h2><div class="top"><p class="src"><a id="v:freeSize" class="def">freeSize</a> :: <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> <a href="#v:freeSize" class="selflink">#</a></p><div class="doc"><p>The size of the free space of the buffer.</p><p>Since 0.1.10.0</p></div></div><div class="top"><p class="src"><a id="v:sliceSize" class="def">sliceSize</a> :: <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> <a href="#v:sliceSize" class="selflink">#</a></p><div class="doc"><p>The size of the written slice in the buffer.</p><p>Since 0.1.10.0</p></div></div><div class="top"><p class="src"><a id="v:bufferSize" class="def">bufferSize</a> :: <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> <a href="#v:bufferSize" class="selflink">#</a></p><div class="doc"><p>The size of the whole byte array underlying the buffer.</p><p>Since 0.1.10.0</p></div></div><h2 id="g:5">Creation and modification</h2><div class="top"><p class="src"><a id="v:allocBuffer" class="def">allocBuffer</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/System-IO.html#t:IO">IO</a> <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a> <a href="#v:allocBuffer" class="selflink">#</a></p><div class="doc"><p><code>allocBuffer size</code> allocates a new buffer of size <code>size</code>.</p><p>Since 0.1.10.0</p></div></div><div class="top"><p class="src"><a id="v:reuseBuffer" class="def">reuseBuffer</a> :: <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a> -> <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a> <a href="#v:reuseBuffer" class="selflink">#</a></p><div class="doc"><p>Resets the beginning of the next slice and the next free byte such that
the whole buffer can be filled again.</p><p>Since 0.1.10.0</p></div></div><div class="top"><p class="src"><a id="v:nextSlice" class="def">nextSlice</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a> <a href="#v:nextSlice" class="selflink">#</a></p><div class="doc"><p>Move the beginning of the slice to the next free byte such that the
remaining free space of the buffer can be filled further. This operation
is safe and can be used to fill the remaining part of the buffer after a
direct insertion of a bytestring or a flush.</p><p>Since 0.1.10.0</p></div></div><h2 id="g:6">Conversion to bytestings</h2><div class="top"><p class="src"><a id="v:unsafeFreezeBuffer" class="def">unsafeFreezeBuffer</a> :: <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> <a href="#v:unsafeFreezeBuffer" class="selflink">#</a></p><div class="doc"><p>Convert the buffer to a bytestring. This operation is unsafe in the sense
that created bytestring shares the underlying byte array with the buffer.
Hence, depending on the later use of this buffer (e.g., if it gets reset and
filled again) referential transparency may be lost.</p><p>Since 0.1.10.0</p></div></div><div class="top"><p class="src"><a id="v:unsafeFreezeNonEmptyBuffer" class="def">unsafeFreezeNonEmptyBuffer</a> :: <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> <a href="#v:unsafeFreezeNonEmptyBuffer" class="selflink">#</a></p><div class="doc"><p>Convert a buffer to a non-empty bytestring. See <code><a href="Data-Conduit-ByteString-Builder.html#v:unsafeFreezeBuffer">unsafeFreezeBuffer</a></code> for
the explanation of why this operation may be unsafe.</p><p>Since 0.1.10.0</p></div></div><h1 id="g:7">Buffer allocation strategies</h1><div class="top"><p class="src"><span class="keyword">type</span> <a id="t:BufferAllocStrategy" class="def">BufferAllocStrategy</a> = (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/System-IO.html#t:IO">IO</a> <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a>, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/System-IO.html#t:IO">IO</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/System-IO.html#t:IO">IO</a> <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a>)) <a href="#t:BufferAllocStrategy" class="selflink">#</a></p><div class="doc"><p>A buffer allocation strategy <code>(buf0, nextBuf)</code> specifies the initial
buffer to use and how to compute a new buffer <code>nextBuf minSize buf</code> with at
least size <code>minSize</code> from a filled buffer <code>buf</code>. The double nesting of the
<code>IO</code> monad helps to ensure that the reference to the filled buffer <code>buf</code> is
lost as soon as possible, but the new buffer doesn't have to be allocated
too early.</p><p>Since 0.1.10.0</p></div></div><div class="top"><p class="src"><a id="v:allNewBuffersStrategy" class="def">allNewBuffersStrategy</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Conduit-ByteString-Builder.html#t:BufferAllocStrategy">BufferAllocStrategy</a> <a href="#v:allNewBuffersStrategy" class="selflink">#</a></p><div class="doc"><p>The simplest buffer allocation strategy: whenever a buffer is requested,
allocate a new one that is big enough for the next build step to execute.</p><p>NOTE that this allocation strategy may spill quite some memory upon direct
insertion of a bytestring by the builder. Thats no problem for garbage
collection, but it may lead to unreasonably high memory consumption in
special circumstances.</p><p>Since 0.1.10.0</p></div></div><div class="top"><p class="src"><a id="v:reuseBufferStrategy" class="def">reuseBufferStrategy</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/System-IO.html#t:IO">IO</a> <a href="Data-Conduit-ByteString-Builder.html#t:Buffer">Buffer</a> -> <a href="Data-Conduit-ByteString-Builder.html#t:BufferAllocStrategy">BufferAllocStrategy</a> <a href="#v:reuseBufferStrategy" class="selflink">#</a></p><div class="doc"><p>An unsafe, but possibly more efficient buffer allocation strategy:
reuse the buffer, if it is big enough for the next build step to execute.</p><p>Since 0.1.10.0</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.3</p></div></body></html>
|