binrep-0.8.0: src/Binrep/Type/Derived/NullTermPadded.hs
{- | Null-terminated, then null-padded data.
This is defined using the composition of existing 'NullTerminate' and
'NullPad' predicates, plus the re-associating binrep instances for the 'And'
predicate combinator. It kind of just magically works.
-}
module Binrep.Type.Derived.NullTermPadded where
import Binrep.Type.NullTerminated
import Binrep.Type.NullPadded
import Refined
-- | Predicate for null-terminated, then null-padded data.
type NullTermPad n = NullTerminate `And` NullPad n
-- | Null-terminated data, which is then null-padded to the given length.
--
-- Instantiate with @ByteString@ for a null-padded C string.
type NullTermPadded n = Refined (NullTermPad n)