Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- pokeFixedLengthByteString :: forall n. KnownNat n => Ptr (FixedArray n Word8) -> ByteString -> IO ()
- pokeFixedLengthNullTerminatedByteString :: forall n. KnownNat n => Ptr (FixedArray n CChar) -> ByteString -> IO ()
- peekByteStringFromSizedVectorPtr :: forall n. KnownNat n => Ptr (FixedArray n Word8) -> IO ByteString
- callocFixedArray :: forall n a. (KnownNat n, Storable a) => IO (Ptr (FixedArray n a))
- lowerArrayPtr :: forall a n. Ptr (FixedArray n a) -> Ptr a
- advancePtrBytes :: Ptr a -> Int -> Ptr a
- data FixedArray (n :: Nat) (a :: Type)
Documentation
pokeFixedLengthByteString :: forall n. KnownNat n => Ptr (FixedArray n Word8) -> ByteString -> IO () Source #
Store a ByteString
in a fixed amount of space, truncating if necessary.
If the ByteString
is not long enough to fill the space the remaining
bytes are unchanged
pokeFixedLengthNullTerminatedByteString :: forall n. KnownNat n => Ptr (FixedArray n CChar) -> ByteString -> IO () Source #
Store a ByteString
in a fixed amount of space inserting a null
character at the end and truncating if necessary.
If the ByteString
is not long enough to fill the space the remaining
bytes are unchanged
Note that if the ByteString
is exactly long enough the last byte will
still be replaced with 0
peekByteStringFromSizedVectorPtr :: forall n. KnownNat n => Ptr (FixedArray n Word8) -> IO ByteString Source #
Peek a ByteString
from a fixed sized array of bytes
callocFixedArray :: forall n a. (KnownNat n, Storable a) => IO (Ptr (FixedArray n a)) Source #
Allocate a zero array with the size specified by the FixedArray
return type. Make sure to release the memory with free
lowerArrayPtr :: forall a n. Ptr (FixedArray n a) -> Ptr a Source #
Get the pointer to the first element in the array