Text.ConstraintedLBS
Contents
Description
The analogue to ordinary lazy ByteString
, but with a constraint on size,
and some routines, thet respects the constraint.
- data CLBS = CLBS {}
- clbsFreeSpaceLeft :: CLBS -> Int64
- newCLBS :: Int64 -> CLBS
- addToCLBS_1 :: (ByteString, Int64) -> CLBS -> CLBS
- freeSpaceCLBS :: CLBS -> CLBS
- addToCLBS_2 :: CLBS -> CLBS -> CLBS
- adjustCLBS_to :: CLBS -> ByteString -> CLBS
- insertInsteadOf_inCLBS :: (ByteString, ByteString) -> CLBS -> CLBS
- resetCLBS :: CLBS -> CLBS
- type StdOut_CLBS = CLBS
- type StdErr_CLBS = CLBS
- type StdOutAndErr_CLBS = CLBS
- concatTruncedLiteraryLBS :: (ByteString, Int64) -> (ByteString, Int64) -> Int64 -> (ByteString, Int64, Bool)
Documentation
The analogue to ordinary lazy ByteString
, but with a constraint on size.
Constructors
CLBS | |
Fields
|
clbsFreeSpaceLeft :: CLBS -> Int64Source
addToCLBS_1 :: (ByteString, Int64) -> CLBS -> CLBSSource
Append first lazy ByteString
(given in tuple with
it's (trusted) length) to a CLBS
. If the result of appending
violates clbsMaxLen constraint, then the content gets truncated,
tailed with "..." and CLBS is finalized (nothing more can be added to it)
freeSpaceCLBS :: CLBS -> CLBSSource
addToCLBS_2 :: CLBS -> CLBS -> CLBSSource
Append first to second. If the result of appending violates clbsMaxLen constraint, then the content gets truncated, tailed with "..." and CLBS is finalized (nothing more can be added to it)
adjustCLBS_to :: CLBS -> ByteString -> CLBSSource
Make CLBS
contain specified ByteString
, keeping the length constraint.
If the specified bytestring violates clbsMaxLen constraint, then
the content gets truncated, tailed with "..."
and CLBS is finalized (nothing more can be added to it)
insertInsteadOf_inCLBS :: (ByteString, ByteString) -> CLBS -> CLBSSource
Given insertInsteadOf_inCLBS (old_separator, new_separator) clbs
,
function replaces every occurence of old_separator
on new_separator
respecting length constraint (and possibly finalizing CLBS
).
Some type aliaces
type StdOut_CLBS = CLBSSource
type StdErr_CLBS = CLBSSource
type StdOutAndErr_CLBS = CLBSSource
Base
concatTruncedLiteraryLBS :: (ByteString, Int64) -> (ByteString, Int64) -> Int64 -> (ByteString, Int64, Bool)Source
Append to first lazy bytestring the second one. The available space
for append is constrainted by the 3rd argument. Every bytestring must
be specified in tuple together with it's length (this is done to
speed up by reducing repeating length
calls), which is trusted.
If length of added string is bigger then available for append,
the result will be truncated and will have a "..." tail.
Function returns resulting ByteString, it's length and boolean indicating if length of added string was bigger than available for append space.