cborg-0.2.9.0: Concise Binary Object Representation (CBOR)

Copyright | (c) Ben Gamari 2017-2018
License | BSD3-style (see LICENSE.txt)
Maintainer | duncan@community.haskell.org
Stability | experimental
Portability | non-portable (GHC extensions)
Safe Haskell | Safe-Inferred
Language | Haskell2010

Codec.CBOR.ByteArray.Sliced

Contents

- Conversions

Description

A ByteArray with more instances than `ByteArray`. Some day when these instances are reliably available from `primitive` we can likely replace this with `ByteArray`.

Synopsis

- data SlicedByteArray = SBA {
  - unSBA :: !ByteArray
  - offset :: !Int
  - length :: !Int
  }
- sizeofSlicedByteArray :: SlicedByteArray -> Int
- fromShortByteString :: ShortByteString -> SlicedByteArray
- fromByteString :: ByteString -> SlicedByteArray
- fromByteArray :: ByteArray -> SlicedByteArray
- toByteString :: SlicedByteArray -> ByteString
- toBuilder :: SlicedByteArray -> Builder

# Documentation

data SlicedByteArray #

Constructors

SBA |

Fields

- unSBA :: !ByteArray
- offset :: !Int
- length :: !Int

#### Instances

Instances details

IsString SlicedByteArray # |
Instance details Defined in Codec.CBOR.ByteArray.Sliced Methods fromString :: String -> SlicedByteArray
IsList SlicedByteArray # |
Instance details Defined in Codec.CBOR.ByteArray.Sliced Associated Types type Item SlicedByteArray Methods fromList :: [Item SlicedByteArray] -> SlicedByteArray fromListN :: Int -> [Item SlicedByteArray] -> SlicedByteArray toList :: SlicedByteArray -> [Item SlicedByteArray]
Show SlicedByteArray # |
Instance details Defined in Codec.CBOR.ByteArray.Sliced Methods showsPrec :: Int -> SlicedByteArray -> ShowS show :: SlicedByteArray -> String showList :: [SlicedByteArray] -> ShowS
Eq SlicedByteArray # |
Instance details Defined in Codec.CBOR.ByteArray.Sliced Methods (==) :: SlicedByteArray -> SlicedByteArray -> Bool (/=) :: SlicedByteArray -> SlicedByteArray -> Bool
Ord SlicedByteArray # |

Instance details

Defined in Codec.CBOR.ByteArray.Sliced

Methods

compare :: SlicedByteArray -> SlicedByteArray -> Ordering

(<) :: SlicedByteArray -> SlicedByteArray -> Bool

(<=) :: SlicedByteArray -> SlicedByteArray -> Bool

(>) :: SlicedByteArray -> SlicedByteArray -> Bool

(>=) :: SlicedByteArray -> SlicedByteArray -> Bool

max :: SlicedByteArray -> SlicedByteArray -> SlicedByteArray

min :: SlicedByteArray -> SlicedByteArray -> SlicedByteArray

type Item SlicedByteArray # |
Instance details Defined in Codec.CBOR.ByteArray.Sliced type Item SlicedByteArray = Word8

# Conversions

sizeofSlicedByteArray :: SlicedByteArray -> Int #

fromShortByteString :: ShortByteString -> SlicedByteArray #

fromByteString :: ByteString -> SlicedByteArray #

fromByteArray :: ByteArray -> SlicedByteArray #

toByteString :: SlicedByteArray -> ByteString #

Note that this may require a copy.

toBuilder :: SlicedByteArray -> Builder #