ByteString.StrictBuilder

bytestring-strict-builder-0.4.5: An efficient strict bytestring builder

Safe Haskell | None
Language | Haskell2010

ByteString.StrictBuilder

Synopsis

- data Builder
- builderBytes :: Builder -> ByteString
- builderChunksBuilder :: Builder -> Builder
- builderLength :: Builder -> Int
- builderPtrFiller :: Builder -> (Int -> (Ptr Word8 -> IO ()) -> result) -> result
- bytes :: ByteString -> Builder
- lazyBytes :: ByteString -> Builder
- asciiIntegral :: Integral a => a -> Builder
- asciiChar :: Char -> Builder
- utf8Char :: Char -> Builder
- storable :: Storable a => a -> Builder
- word8 :: Word8 -> Builder
- word16BE :: Word16 -> Builder
- word32BE :: Word32 -> Builder
- word64BE :: Word64 -> Builder
- int8 :: Int8 -> Builder
- int16BE :: Int16 -> Builder
- int32BE :: Int32 -> Builder
- int64BE :: Int64 -> Builder

# Documentation

data Builder #

Instances

Show Builder # |
Methods showsPrec :: Int -> Builder -> ShowS # show :: Builder -> String # showList :: [Builder] -> ShowS #
IsString Builder # |
Methods fromString :: String -> Builder #
Semigroup Builder # |
Methods (<>) :: Builder -> Builder -> Builder # sconcat :: NonEmpty Builder -> Builder # stimes :: Integral b => b -> Builder -> Builder #
Monoid Builder # |
Methods mempty :: Builder # mappend :: Builder -> Builder -> Builder # mconcat :: [Builder] -> Builder #

builderBytes :: Builder -> ByteString #

Efficiently constructs a strict bytestring.

builderChunksBuilder :: Builder -> Builder #

Converts into the standard lazy bytestring builder. Does so efficiently using the internal APIs of "bytestring", without producing any intermediate representation.

builderLength :: Builder -> Int #

O(1). Gets the size of the bytestring that is to be produced.

builderPtrFiller #

Arguments

:: Builder |
-> (Int -> (Ptr Word8 -> IO ()) -> result) | A continuation on the amount of bytes to be written and the action populating the pointer.
-> result |

Use the builder to populate a buffer. It is your responsibility to ensure that the bounds are not exceeded.

bytes :: ByteString -> Builder #

lazyBytes :: ByteString -> Builder #

asciiIntegral :: Integral a => a -> Builder #

asciiChar :: Char -> Builder #

utf8Char :: Char -> Builder #

storable :: Storable a => a -> Builder #

word8 :: Word8 -> Builder #

word16BE :: Word16 -> Builder #

word32BE :: Word32 -> Builder #

word64BE :: Word64 -> Builder #

int8 :: Int8 -> Builder #

int16BE :: Int16 -> Builder #

int32BE :: Int32 -> Builder #

int64BE :: Int64 -> Builder #