Add shortByteString builder. Prepare the changelog for a major release.
This commit is contained in:
parent
691749e27a
commit
a66f8e1200
2 changed files with 16 additions and 3 deletions
|
@ -18,6 +18,7 @@ module Data.ByteArray.Builder
|
|||
, copy
|
||||
, insert
|
||||
, byteArray
|
||||
, shortByteString
|
||||
, shortTextUtf8
|
||||
, shortTextJsonString
|
||||
, cstring
|
||||
|
@ -184,6 +185,11 @@ fromBoundedOne (UnsafeBounded.Builder f) = Builder $ \buf0 off0 len0 cs0 s0 ->
|
|||
byteArray :: ByteArray -> Builder
|
||||
byteArray a = bytes (Bytes a 0 (PM.sizeofByteArray a))
|
||||
|
||||
-- | Create a builder from a short bytestring.
|
||||
shortByteString :: ShortByteString -> Builder
|
||||
shortByteString (SBS x) = bytes (Bytes a 0 (PM.sizeofByteArray a))
|
||||
where a = ByteArray x
|
||||
|
||||
-- | Create a builder from a sliced byte sequence. The variants
|
||||
-- 'copy' and 'insert' provide more control over whether or not
|
||||
-- the byte sequence is copied or aliased. This function is preferred
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue