cborg-0.2.10.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 Source #

Constructors

SBA |

Fields

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

#### Instances

Instances details

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

Instance details

Defined in Codec.CBOR.ByteArray.Sliced

Methods

compare :: SlicedByteArray -> SlicedByteArray -> Ordering Source #

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

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

(>) :: SlicedByteArray -> SlicedByteArray -> Bool Source #

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

max :: SlicedByteArray -> SlicedByteArray -> SlicedByteArray Source #

min :: SlicedByteArray -> SlicedByteArray -> SlicedByteArray Source #

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

# Conversions

sizeofSlicedByteArray :: SlicedByteArray -> Int Source #

fromShortByteString :: ShortByteString -> SlicedByteArray Source #

fromByteString :: ByteString -> SlicedByteArray Source #

fromByteArray :: ByteArray -> SlicedByteArray Source #

toByteString :: SlicedByteArray -> ByteString Source #

Note that this may require a copy.

toBuilder :: SlicedByteArray -> Builder Source #