| Copyright | (c) Alexey Kuleshevich 2024 |
|---|---|
| License | BSD3 |
| Maintainer | Alexey Kuleshevich <alexey@kuleshevi.ch> |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Data.MemPack.Buffer
Description
Synopsis
- class Buffer b where
- bufferByteCount :: b -> Int
- buffer :: b -> (ByteArray# -> a) -> (Addr# -> a) -> a
- newMutableByteArray :: Bool -> Int -> ST s (MutableByteArray s)
- freezeMutableByteArray :: MutableByteArray d -> ST d ByteArray
- withPtrByteStringST :: ByteString -> (Ptr a -> ST s b) -> ST s b
- pinnedByteArrayToByteString :: ByteArray -> ByteString
- pinnedByteArrayToForeignPtr :: ByteArray# -> ForeignPtr a
- byteArrayToShortByteString :: ByteArray -> ShortByteString
- byteArrayFromShortByteString :: ShortByteString -> ByteArray
Documentation
Immutable memory buffer
Methods
bufferByteCount :: b -> Int Source #
buffer :: b -> (ByteArray# -> a) -> (Addr# -> a) -> a Source #
Instances
| Buffer ByteArray Source # | |
Defined in Data.MemPack.Buffer | |
| Buffer ByteString Source # | |
Defined in Data.MemPack.Buffer Methods bufferByteCount :: ByteString -> Int Source # buffer :: ByteString -> (ByteArray# -> a) -> (Addr# -> a) -> a Source # | |
| Buffer ShortByteString Source # | |
Defined in Data.MemPack.Buffer Methods bufferByteCount :: ShortByteString -> Int Source # buffer :: ShortByteString -> (ByteArray# -> a) -> (Addr# -> a) -> a Source # | |
newMutableByteArray :: Bool -> Int -> ST s (MutableByteArray s) Source #
freezeMutableByteArray :: MutableByteArray d -> ST d ByteArray Source #
withPtrByteStringST :: ByteString -> (Ptr a -> ST s b) -> ST s b Source #
It is ok to use ByteString withing ST, as long as underlying pointer is never mutated or returned from the supplied action.