Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Unsigned LEB128 codec. This codec encodes an unsigned number as described here.
Any getXXX decoder can decode bytes generated using any of the putXXX encoders, provided the encoded number fits in the target type.
WARNING: This is not compatible with the Signed LEB128 codec at Data.Binary.SLEB128 nor with the ZigZag LEB128 codec at Data.Binary.ZLEB128.
Synopsis
- newtype ULEB128 x = ULEB128 x
- putNatural :: Natural -> Put
- putWord64 :: Word64 -> Put
- putWord32 :: Word32 -> Put
- putWord16 :: Word16 -> Put
- putWord8 :: Word8 -> Put
- putWord :: Word -> Put
- getNatural :: Int -> Get Natural
- getWord64 :: Get Word64
- getWord32 :: Get Word32
- getWord16 :: Get Word16
- getWord8 :: Get Word8
- getWord :: Get Word
- getInteger :: Int -> Get Integer
- getInt64 :: Get Int64
- getInt32 :: Get Int32
- getInt16 :: Get Int16
- getInt8 :: Get Int8
- getInt :: Get Int
- putByteString :: ByteString -> Put
- getByteString :: Get ByteString
- putLazyByteString :: ByteString -> Put
- getLazyByteString :: Get ByteString
- putShortByteString :: ShortByteString -> Put
- getShortByteString :: Get ShortByteString
Documentation
Newtype wrapper for Binary
encoding and decoding x
using the
Unsigned LEB128 codec. Useful in conjunction with DerivingVia
.
ULEB128 x |
Instances
(DecodeOnly "getInt16" :: Constraint) => Binary (ULEB128 Int16) Source # | |
(DecodeOnly "getInt32" :: Constraint) => Binary (ULEB128 Int32) Source # | |
(DecodeOnly "getInt64" :: Constraint) => Binary (ULEB128 Int64) Source # | |
(DecodeOnly "getInt8" :: Constraint) => Binary (ULEB128 Int8) Source # | |
Binary (ULEB128 Word16) Source # | |
Binary (ULEB128 Word32) Source # | |
Binary (ULEB128 Word64) Source # | |
Binary (ULEB128 Word8) Source # | |
(DecodeOnly "getInteger" :: Constraint) => Binary (ULEB128 Integer) Source # | |
Binary (ULEB128 Natural) Source # | Note: Maximum allowed number of input bytes is restricted to 1024.
Use |
(DecodeOnly "getInt" :: Constraint) => Binary (ULEB128 Int) Source # | |
Binary (ULEB128 Word) Source # | |
Put
putNatural :: Natural -> Put Source #
Get
ByteString
putByteString :: ByteString -> Put Source #
Puts a strict ByteString
with its ULEB128-encoded length as prefix.
See getByteString
.
getByteString :: Get ByteString Source #
Gets a strict ByteString
with its ULEB128-encoded length as prefix.
See putByteString
.
Lazy
putLazyByteString :: ByteString -> Put Source #
Puts a lazy ByteString
with its ULEB128-encoded length as prefix.
See getLazyByteString
.
getLazyByteString :: Get ByteString Source #
Gets a lazy ByteString
with its ULEB128-encoded length as prefix.
See putLazyByteString
.
Short
putShortByteString :: ShortByteString -> Put Source #
Puts a ShortByteString
with its ULEB128-encoded length as prefix.
See getShortByteString
.
getShortByteString :: Get ShortByteString Source #
Gets a ShortByteString
with its ULEB128-encoded length as prefix.
See putShortByteString
.