Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Contains the public fields of a GByteArray.
Synopsis
- newtype ByteArray = ByteArray (ManagedPtr ByteArray)
- newZeroByteArray :: MonadIO m => m ByteArray
- byteArrayFree :: (HasCallStack, MonadIO m) => ByteString -> Bool -> m Word8
- byteArrayFreeToBytes :: (HasCallStack, MonadIO m) => ByteString -> m Bytes
- byteArrayNew :: (HasCallStack, MonadIO m) => m ByteString
- byteArrayNewTake :: (HasCallStack, MonadIO m) => ByteString -> m ByteString
- byteArraySteal :: (HasCallStack, MonadIO m) => ByteString -> m (Word8, Word64)
- byteArrayUnref :: (HasCallStack, MonadIO m) => ByteString -> m ()
- getByteArrayData :: MonadIO m => ByteArray -> m Word8
- setByteArrayData :: MonadIO m => ByteArray -> Word8 -> m ()
- getByteArrayLen :: MonadIO m => ByteArray -> m Word32
- setByteArrayLen :: MonadIO m => ByteArray -> Word32 -> m ()
Exported types
Memory-managed wrapper type.
Instances
Eq ByteArray Source # | |
GBoxed ByteArray Source # | |
Defined in GI.GLib.Structs.ByteArray | |
ManagedPtrNewtype ByteArray Source # | |
Defined in GI.GLib.Structs.ByteArray toManagedPtr :: ByteArray -> ManagedPtr ByteArray | |
TypedObject ByteArray Source # | |
Defined in GI.GLib.Structs.ByteArray | |
HasParentTypes ByteArray Source # | |
Defined in GI.GLib.Structs.ByteArray | |
tag ~ 'AttrSet => Constructible ByteArray tag Source # | |
IsGValue (Maybe ByteArray) Source # | Convert |
Defined in GI.GLib.Structs.ByteArray gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe ByteArray -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe ByteArray) | |
type ParentTypes ByteArray Source # | |
Defined in GI.GLib.Structs.ByteArray |
newZeroByteArray :: MonadIO m => m ByteArray Source #
Construct a ByteArray
struct initialized to zero.
Methods
free
:: (HasCallStack, MonadIO m) | |
=> ByteString |
|
-> Bool |
|
-> m Word8 | Returns: the element data if |
freeToBytes
:: (HasCallStack, MonadIO m) | |
=> ByteString |
|
-> m Bytes | Returns: a new immutable |
Transfers the data from the ByteArray
into a new immutable Bytes
.
The ByteArray
is freed unless the reference count of array
is greater
than one, the ByteArray
wrapper is preserved but the size of array
will be set to zero.
This is identical to using bytesNewTake
and byteArrayFree
together.
Since: 2.32
new
:: (HasCallStack, MonadIO m) | |
=> m ByteString | Returns: the new |
Creates a new ByteArray
with a reference count of 1.
newTake
:: (HasCallStack, MonadIO m) | |
=> ByteString |
|
-> m ByteString | Returns: a new |
steal
:: (HasCallStack, MonadIO m) | |
=> ByteString |
|
-> m (Word8, Word64) | Returns: the element data, which should be
freed using |
Frees the data in the array and resets the size to zero, while the underlying array is preserved for use elsewhere and returned to the caller.
Since: 2.64
unref
:: (HasCallStack, MonadIO m) | |
=> ByteString |
|
-> m () |
Atomically decrements the reference count of array
by one. If the
reference count drops to 0, all memory allocated by the array is
released. This function is thread-safe and may be called from any
thread.
Since: 2.22
Properties
data
a pointer to the element data. The data may be moved as
elements are added to the ByteArray
getByteArrayData :: MonadIO m => ByteArray -> m Word8 Source #
Get the value of the “data
” field.
When overloading is enabled, this is equivalent to
get
byteArray #data
setByteArrayData :: MonadIO m => ByteArray -> Word8 -> m () Source #
Set the value of the “data
” field.
When overloading is enabled, this is equivalent to
set
byteArray [ #data:=
value ]
len
the number of elements in the ByteArray
getByteArrayLen :: MonadIO m => ByteArray -> m Word32 Source #
Get the value of the “len
” field.
When overloading is enabled, this is equivalent to
get
byteArray #len
setByteArrayLen :: MonadIO m => ByteArray -> Word32 -> m () Source #
Set the value of the “len
” field.
When overloading is enabled, this is equivalent to
set
byteArray [ #len:=
value ]