memory-0.15.0: memory and related abstraction stuff
LicenseBSD-style
MaintainerNicolas DI PRIMA <nicolas@di-prima.fr>
Stabilitystable
PortabilityGood
Safe HaskellNone
LanguageHaskell2010

Data.ByteArray.View

Description

a View on a given ByteArrayAccess

Synopsis

Documentation

data View bytes Source #

a view on a given bytes

Equality test in constant time

Instances

Instances details
ByteArrayAccess bytes => Eq (View bytes) Source # 
Instance details

Defined in Data.ByteArray.View

Methods

(==) :: View bytes -> View bytes -> Bool Source #

(/=) :: View bytes -> View bytes -> Bool Source #

ByteArrayAccess bytes => Ord (View bytes) Source # 
Instance details

Defined in Data.ByteArray.View

Methods

compare :: View bytes -> View bytes -> Ordering Source #

(<) :: View bytes -> View bytes -> Bool Source #

(<=) :: View bytes -> View bytes -> Bool Source #

(>) :: View bytes -> View bytes -> Bool Source #

(>=) :: View bytes -> View bytes -> Bool Source #

max :: View bytes -> View bytes -> View bytes Source #

min :: View bytes -> View bytes -> View bytes Source #

ByteArrayAccess bytes => Show (View bytes) Source # 
Instance details

Defined in Data.ByteArray.View

Methods

showsPrec :: Int -> View bytes -> ShowS Source #

show :: View bytes -> String Source #

showList :: [View bytes] -> ShowS Source #

ByteArrayAccess bytes => ByteArrayAccess (View bytes) Source # 
Instance details

Defined in Data.ByteArray.View

Methods

length :: View bytes -> Int Source #

withByteArray :: View bytes -> (Ptr p -> IO a) -> IO a Source #

copyByteArrayToPtr :: View bytes -> Ptr p -> IO () Source #

view Source #

Arguments

:: ByteArrayAccess bytes 
=> bytes

the byte array we put a view on

-> Int

the offset to start the byte array on

-> Int

the size of the view

-> View bytes 

create a view on a given bytearray

This function update the offset and the size in order to guarantee:

  • offset >= 0
  • size >= 0
  • offset < length
  • size =< length - offset

takeView Source #

Arguments

:: ByteArrayAccess bytes 
=> bytes

byte aray

-> Int

size of the view

-> View bytes 

create a view from the given bytearray

dropView Source #

Arguments

:: ByteArrayAccess bytes 
=> bytes

byte array

-> Int

the number of bytes do dropped before creating the view

-> View bytes 

create a view from the given byte array starting after having dropped the fist n bytes