{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE NoFieldSelectors #-}
{-# LANGUAGE NoImplicitPrelude #-}

-- | SDL offers a way to perform I\/O asynchronously. This allows an app to read or write files without waiting for data to actually transfer; the functions that request I\/O never block while the request is fulfilled.
--
--     Instead, the data moves in the background and the app can check for results at their leisure.
--
--     This is more complicated than just reading and writing files in a synchronous way, but it can allow for more efficiency, and never having framerate drops as the hard drive catches up, etc.
--
--     The general usage pattern for async I\/O is:
--
--     * Create one or more 'SDL_AsyncIOQueue' objects.
--
--     * Open files with SDL_AsyncIOFromFile.
--
--     * Start I\/O tasks to the files with SDL_ReadAsyncIO or SDL_WriteAsyncIO, putting those tasks into one of the queues.
--
--     * Later on, use SDL_GetAsyncIOResult on a queue to see if any task is finished without blocking. Tasks might finish in any order with success or failure.
--
--     * When all your tasks are done, close the file with SDL_CloseAsyncIO. This also generates a task, since it might flush data to disk!
--
--     This all works, without blocking, in a single thread, but one can also wait on a queue in a background thread, sleeping until new results have arrived:
--
--     * Call SDL_WaitAsyncIOResult from one or more threads to efficiently block until new tasks complete.
--
--     * When shutting down, call SDL_SignalAsyncIOQueue to unblock any sleeping threads despite there being no new tasks completed.
--
--     And, of course, to match the synchronous SDL_LoadFile, we offer SDL_LoadFileAsync as a convenience function. This will handle allocating a buffer, slurping in the file data, and null-terminating it; you still check for results later.
--
--     Behind the scenes, SDL will use newer, efficient APIs on platforms that support them: Linux\'s io_uring and Windows 11\'s IoRing, for example. If those technologies aren\'t available, SDL will offload the work to a thread pool that will manage otherwise-synchronous loads without blocking the app.
--
--     Best Practices
--
--     Simple non-blocking I\/O for an app that just wants to pick up data whenever it\'s ready without losing framerate waiting on disks to spin can use whatever pattern works well for the program. In this case, simply call SDL_ReadAsyncIO, or maybe SDL_LoadFileAsync, as needed. Once a frame, call SDL_GetAsyncIOResult to check for any completed tasks and deal with the data as it arrives.
--
--     If two separate pieces of the same program need their own I\/O, it is legal for each to create their own queue. This will prevent either piece from accidentally consuming the other\'s completed tasks. Each queue does require some amount of resources, but it is not an overwhelming cost. Do not make a queue for each task, however. It is better to put many tasks into a single queue. They will be reported in order of completion, not in the order they were submitted, so it doesn\'t generally matter what order tasks are started.
--
--     One async I\/O queue can be shared by multiple threads, or one thread can have more than one queue, but the most efficient way if ruthless efficiency is the goal is to have one queue per thread, with multiple threads working in parallel, and attempt to keep each queue loaded with tasks that are both started by and consumed by the same thread. On modern platforms that can use newer interfaces, this can keep data flowing as efficiently as possible all the way from storage hardware to the app, with no contention between threads for access to the same queue.
--
--     Written data is not guaranteed to make it to physical media by the time a closing task is completed, unless SDL_CloseAsyncIO is called with its @flush@ parameter set to true, which is to say that a successful result here can still result in lost data during an unfortunately-timed power outage if not flushed. However, flushing will take longer and may be unnecessary, depending on the app\'s needs. The asynchronous I\/O operation structure.
--
--     This operates as an opaque handle. One can then request read or write operations on it.
--
--     @since 3.2.0
--
--     [See also]: 'sDL_AsyncIOFromFile'
module SDL3.Sys.Bindgen.Asyncio (
  SDL3.Sys.Bindgen.Asyncio.SDL_AsyncIO,
  SDL3.Sys.Bindgen.Asyncio.SDL_AsyncIOTaskType (..),
  pattern SDL3.Sys.Bindgen.Asyncio.SDL_ASYNCIO_TASK_READ,
  pattern SDL3.Sys.Bindgen.Asyncio.SDL_ASYNCIO_TASK_WRITE,
  pattern SDL3.Sys.Bindgen.Asyncio.SDL_ASYNCIO_TASK_CLOSE,
  SDL3.Sys.Bindgen.Asyncio.SDL_AsyncIOResult (..),
  pattern SDL3.Sys.Bindgen.Asyncio.SDL_ASYNCIO_COMPLETE,
  pattern SDL3.Sys.Bindgen.Asyncio.SDL_ASYNCIO_FAILURE,
  pattern SDL3.Sys.Bindgen.Asyncio.SDL_ASYNCIO_CANCELED,
  SDL3.Sys.Bindgen.Asyncio.SDL_AsyncIOOutcome (..),
  SDL3.Sys.Bindgen.Asyncio.SDL_AsyncIOQueue,
)
where

import Prelude (Eq, Int, Ord, Read, Show, pure, (<*>), (>>), type (~))

import HsBindgen.Runtime.CEnum qualified as CEnum
import HsBindgen.Runtime.HasCField qualified as HasCField
import HsBindgen.Runtime.Marshal qualified as Marshal
import HsBindgen.Runtime.Struct qualified as Struct
import HsBindgen.Runtime.Support qualified as BG
import HsBindgen.Runtime.Support.CompatHasField qualified as BG.CompatHasField
import SDL3.Sys.Bindgen.Stdinc qualified

-- | [C declaration]: @struct SDL_AsyncIO@, defined at @SDL3\/SDL_asyncio.h 124:16@
data SDL_AsyncIO

-- | Types of asynchronous I\/O tasks.
--
--     @since 3.2.0
--
--     [C declaration]: @enum SDL_AsyncIOTaskType@, defined at @SDL3\/SDL_asyncio.h 131:14@
newtype SDL_AsyncIOTaskType = SDL_AsyncIOTaskType
  { SDL_AsyncIOTaskType -> CUInt
unwrap :: BG.CUInt
  }
  deriving stock ((forall x. SDL_AsyncIOTaskType -> Rep SDL_AsyncIOTaskType x)
-> (forall x. Rep SDL_AsyncIOTaskType x -> SDL_AsyncIOTaskType)
-> Generic SDL_AsyncIOTaskType
forall x. Rep SDL_AsyncIOTaskType x -> SDL_AsyncIOTaskType
forall x. SDL_AsyncIOTaskType -> Rep SDL_AsyncIOTaskType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SDL_AsyncIOTaskType -> Rep SDL_AsyncIOTaskType x
from :: forall x. SDL_AsyncIOTaskType -> Rep SDL_AsyncIOTaskType x
$cto :: forall x. Rep SDL_AsyncIOTaskType x -> SDL_AsyncIOTaskType
to :: forall x. Rep SDL_AsyncIOTaskType x -> SDL_AsyncIOTaskType
BG.Generic, SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> Bool
(SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> Bool)
-> (SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> Bool)
-> Eq SDL_AsyncIOTaskType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> Bool
== :: SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> Bool
$c/= :: SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> Bool
/= :: SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> Bool
Eq, Eq SDL_AsyncIOTaskType
Eq SDL_AsyncIOTaskType =>
(SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> Ordering)
-> (SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> Bool)
-> (SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> Bool)
-> (SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> Bool)
-> (SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> Bool)
-> (SDL_AsyncIOTaskType
    -> SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType)
-> (SDL_AsyncIOTaskType
    -> SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType)
-> Ord SDL_AsyncIOTaskType
SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> Bool
SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> Ordering
SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> Ordering
compare :: SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> Ordering
$c< :: SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> Bool
< :: SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> Bool
$c<= :: SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> Bool
<= :: SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> Bool
$c> :: SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> Bool
> :: SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> Bool
$c>= :: SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> Bool
>= :: SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> Bool
$cmax :: SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType
max :: SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType
$cmin :: SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType
min :: SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType
Ord)
  deriving newtype (FFIType SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType
SDL_AsyncIOTaskType -> FFIType SDL_AsyncIOTaskType
(SDL_AsyncIOTaskType -> FFIType SDL_AsyncIOTaskType)
-> (FFIType SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType)
-> HasFFIType SDL_AsyncIOTaskType
forall a. (a -> FFIType a) -> (FFIType a -> a) -> HasFFIType a
$ctoFFIType :: SDL_AsyncIOTaskType -> FFIType SDL_AsyncIOTaskType
toFFIType :: SDL_AsyncIOTaskType -> FFIType SDL_AsyncIOTaskType
$cfromFFIType :: FFIType SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType
fromFFIType :: FFIType SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType
BG.HasFFIType)

instance Marshal.StaticSize SDL_AsyncIOTaskType where
  staticSizeOf :: Proxy SDL_AsyncIOTaskType -> Int
staticSizeOf = \Proxy SDL_AsyncIOTaskType
_ -> (Int
4 :: Int)

  staticAlignment :: Proxy SDL_AsyncIOTaskType -> Int
staticAlignment = \Proxy SDL_AsyncIOTaskType
_ -> (Int
4 :: Int)

instance Marshal.ReadRaw SDL_AsyncIOTaskType where
  readRaw :: Ptr SDL_AsyncIOTaskType -> IO SDL_AsyncIOTaskType
readRaw =
    \Ptr SDL_AsyncIOTaskType
ptr0 ->
      (CUInt -> SDL_AsyncIOTaskType) -> IO (CUInt -> SDL_AsyncIOTaskType)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure CUInt -> SDL_AsyncIOTaskType
SDL_AsyncIOTaskType
        IO (CUInt -> SDL_AsyncIOTaskType)
-> IO CUInt -> IO SDL_AsyncIOTaskType
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Ptr SDL_AsyncIOTaskType -> Int -> IO CUInt
forall a b. ReadRaw a => Ptr b -> Int -> IO a
Marshal.readRawByteOff Ptr SDL_AsyncIOTaskType
ptr0 (Int
0 :: Int)

instance Marshal.WriteRaw SDL_AsyncIOTaskType where
  writeRaw :: Ptr SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType -> IO ()
writeRaw =
    \Ptr SDL_AsyncIOTaskType
ptr0 ->
      \SDL_AsyncIOTaskType
s1 ->
        case SDL_AsyncIOTaskType
s1 of
          SDL_AsyncIOTaskType CUInt
unwrap2 ->
            Ptr SDL_AsyncIOTaskType -> Int -> CUInt -> IO ()
forall a b. WriteRaw a => Ptr b -> Int -> a -> IO ()
Marshal.writeRawByteOff Ptr SDL_AsyncIOTaskType
ptr0 (Int
0 :: Int) CUInt
unwrap2

deriving via Marshal.EquivStorable SDL_AsyncIOTaskType instance BG.Storable SDL_AsyncIOTaskType

deriving via BG.CUInt instance BG.Prim SDL_AsyncIOTaskType

instance CEnum.CEnum SDL_AsyncIOTaskType where
  type CEnumZ SDL_AsyncIOTaskType = BG.CUInt

  toCEnum :: CEnumZ SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType
toCEnum = CUInt -> SDL_AsyncIOTaskType
CEnumZ SDL_AsyncIOTaskType -> SDL_AsyncIOTaskType
SDL_AsyncIOTaskType

  fromCEnum :: SDL_AsyncIOTaskType -> CEnumZ SDL_AsyncIOTaskType
fromCEnum = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"unwrap"

  declaredValues :: forall (proxy :: * -> *).
proxy SDL_AsyncIOTaskType -> DeclaredValues SDL_AsyncIOTaskType
declaredValues =
    \proxy SDL_AsyncIOTaskType
_ ->
      [(CEnumZ SDL_AsyncIOTaskType, NonEmpty String)]
-> DeclaredValues SDL_AsyncIOTaskType
forall a.
Ord (CEnumZ a) =>
[(CEnumZ a, NonEmpty String)] -> DeclaredValues a
CEnum.declaredValuesFromList
        [ (CUInt
CEnumZ SDL_AsyncIOTaskType
0, String -> NonEmpty String
forall a. a -> NonEmpty a
BG.singleton String
"SDL_ASYNCIO_TASK_READ")
        , (CUInt
CEnumZ SDL_AsyncIOTaskType
1, String -> NonEmpty String
forall a. a -> NonEmpty a
BG.singleton String
"SDL_ASYNCIO_TASK_WRITE")
        , (CUInt
CEnumZ SDL_AsyncIOTaskType
2, String -> NonEmpty String
forall a. a -> NonEmpty a
BG.singleton String
"SDL_ASYNCIO_TASK_CLOSE")
        ]

  showsUndeclared :: forall (proxy :: * -> *).
proxy SDL_AsyncIOTaskType
-> Int -> CEnumZ SDL_AsyncIOTaskType -> ShowS
showsUndeclared =
    String
-> proxy SDL_AsyncIOTaskType
-> Int
-> CEnumZ SDL_AsyncIOTaskType
-> ShowS
forall a (proxy :: * -> *).
Show (CEnumZ a) =>
String -> proxy a -> Int -> CEnumZ a -> ShowS
CEnum.showsWrappedUndeclared String
"SDL_AsyncIOTaskType"

  readPrecUndeclared :: ReadPrec SDL_AsyncIOTaskType
readPrecUndeclared =
    String -> ReadPrec SDL_AsyncIOTaskType
forall a. (CEnum a, Read (CEnumZ a)) => String -> ReadPrec a
CEnum.readPrecWrappedUndeclared String
"SDL_AsyncIOTaskType"

  isDeclared :: SDL_AsyncIOTaskType -> Bool
isDeclared = SDL_AsyncIOTaskType -> Bool
forall a. SequentialCEnum a => a -> Bool
CEnum.seqIsDeclared

  mkDeclared :: CEnumZ SDL_AsyncIOTaskType -> Maybe SDL_AsyncIOTaskType
mkDeclared = CEnumZ SDL_AsyncIOTaskType -> Maybe SDL_AsyncIOTaskType
forall a. SequentialCEnum a => CEnumZ a -> Maybe a
CEnum.seqMkDeclared

instance CEnum.SequentialCEnum SDL_AsyncIOTaskType where
  minDeclaredValue :: SDL_AsyncIOTaskType
minDeclaredValue = SDL_AsyncIOTaskType
SDL_ASYNCIO_TASK_READ

  maxDeclaredValue :: SDL_AsyncIOTaskType
maxDeclaredValue = SDL_AsyncIOTaskType
SDL_ASYNCIO_TASK_CLOSE

instance Show SDL_AsyncIOTaskType where
  showsPrec :: Int -> SDL_AsyncIOTaskType -> ShowS
showsPrec = Int -> SDL_AsyncIOTaskType -> ShowS
forall a. CEnum a => Int -> a -> ShowS
CEnum.shows

instance Read SDL_AsyncIOTaskType where
  readPrec :: ReadPrec SDL_AsyncIOTaskType
readPrec = ReadPrec SDL_AsyncIOTaskType
forall a. CEnum a => ReadPrec a
CEnum.readPrec

  readList :: ReadS [SDL_AsyncIOTaskType]
readList = ReadS [SDL_AsyncIOTaskType]
forall a. Read a => ReadS [a]
BG.readListDefault

  readListPrec :: ReadPrec [SDL_AsyncIOTaskType]
readListPrec = ReadPrec [SDL_AsyncIOTaskType]
forall a. Read a => ReadPrec [a]
BG.readListPrecDefault

instance
  (ty ~ BG.CUInt)
  => BG.CompatHasField.HasField "unwrap" SDL_AsyncIOTaskType ty
  where
  hasField :: SDL_AsyncIOTaskType -> (ty -> SDL_AsyncIOTaskType, ty)
hasField =
    \SDL_AsyncIOTaskType
x0 ->
      ( \ty
y1 ->
          SDL_AsyncIOTaskType{unwrap :: CUInt
unwrap = ty
CUInt
y1}
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"unwrap" SDL_AsyncIOTaskType
x0
      )

instance
  (ty ~ BG.CUInt)
  => BG.HasField "unwrap" (BG.Ptr SDL_AsyncIOTaskType) (BG.Ptr ty)
  where
  getField :: Ptr SDL_AsyncIOTaskType -> Ptr ty
getField = Proxy "unwrap"
-> Ptr SDL_AsyncIOTaskType
-> Ptr (CFieldType SDL_AsyncIOTaskType "unwrap")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"unwrap")

instance HasCField.HasCField SDL_AsyncIOTaskType "unwrap" where
  type
    CFieldType SDL_AsyncIOTaskType "unwrap" =
      BG.CUInt

  offset# :: Proxy# SDL_AsyncIOTaskType -> Proxy# "unwrap" -> Int
offset# = \Proxy# SDL_AsyncIOTaskType
_ -> \Proxy# "unwrap"
_ -> Int
0

-- | A read operation.
--
--     [C declaration]: @SDL_ASYNCIO_TASK_READ@, defined at @SDL3\/SDL_asyncio.h 133:5@
pattern SDL_ASYNCIO_TASK_READ :: SDL_AsyncIOTaskType
pattern $mSDL_ASYNCIO_TASK_READ :: forall {r}.
SDL_AsyncIOTaskType -> ((# #) -> r) -> ((# #) -> r) -> r
$bSDL_ASYNCIO_TASK_READ :: SDL_AsyncIOTaskType
SDL_ASYNCIO_TASK_READ = SDL_AsyncIOTaskType 0

-- | A write operation.
--
--     [C declaration]: @SDL_ASYNCIO_TASK_WRITE@, defined at @SDL3\/SDL_asyncio.h 134:5@
pattern SDL_ASYNCIO_TASK_WRITE :: SDL_AsyncIOTaskType
pattern $mSDL_ASYNCIO_TASK_WRITE :: forall {r}.
SDL_AsyncIOTaskType -> ((# #) -> r) -> ((# #) -> r) -> r
$bSDL_ASYNCIO_TASK_WRITE :: SDL_AsyncIOTaskType
SDL_ASYNCIO_TASK_WRITE = SDL_AsyncIOTaskType 1

-- | A close operation.
--
--     [C declaration]: @SDL_ASYNCIO_TASK_CLOSE@, defined at @SDL3\/SDL_asyncio.h 135:5@
pattern SDL_ASYNCIO_TASK_CLOSE :: SDL_AsyncIOTaskType
pattern $mSDL_ASYNCIO_TASK_CLOSE :: forall {r}.
SDL_AsyncIOTaskType -> ((# #) -> r) -> ((# #) -> r) -> r
$bSDL_ASYNCIO_TASK_CLOSE :: SDL_AsyncIOTaskType
SDL_ASYNCIO_TASK_CLOSE = SDL_AsyncIOTaskType 2

-- | Possible outcomes of an asynchronous I\/O task.
--
--     @since 3.2.0
--
--     [C declaration]: @enum SDL_AsyncIOResult@, defined at @SDL3\/SDL_asyncio.h 143:14@
newtype SDL_AsyncIOResult = SDL_AsyncIOResult
  { SDL_AsyncIOResult -> CUInt
unwrap :: BG.CUInt
  }
  deriving stock ((forall x. SDL_AsyncIOResult -> Rep SDL_AsyncIOResult x)
-> (forall x. Rep SDL_AsyncIOResult x -> SDL_AsyncIOResult)
-> Generic SDL_AsyncIOResult
forall x. Rep SDL_AsyncIOResult x -> SDL_AsyncIOResult
forall x. SDL_AsyncIOResult -> Rep SDL_AsyncIOResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SDL_AsyncIOResult -> Rep SDL_AsyncIOResult x
from :: forall x. SDL_AsyncIOResult -> Rep SDL_AsyncIOResult x
$cto :: forall x. Rep SDL_AsyncIOResult x -> SDL_AsyncIOResult
to :: forall x. Rep SDL_AsyncIOResult x -> SDL_AsyncIOResult
BG.Generic, SDL_AsyncIOResult -> SDL_AsyncIOResult -> Bool
(SDL_AsyncIOResult -> SDL_AsyncIOResult -> Bool)
-> (SDL_AsyncIOResult -> SDL_AsyncIOResult -> Bool)
-> Eq SDL_AsyncIOResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SDL_AsyncIOResult -> SDL_AsyncIOResult -> Bool
== :: SDL_AsyncIOResult -> SDL_AsyncIOResult -> Bool
$c/= :: SDL_AsyncIOResult -> SDL_AsyncIOResult -> Bool
/= :: SDL_AsyncIOResult -> SDL_AsyncIOResult -> Bool
Eq, Eq SDL_AsyncIOResult
Eq SDL_AsyncIOResult =>
(SDL_AsyncIOResult -> SDL_AsyncIOResult -> Ordering)
-> (SDL_AsyncIOResult -> SDL_AsyncIOResult -> Bool)
-> (SDL_AsyncIOResult -> SDL_AsyncIOResult -> Bool)
-> (SDL_AsyncIOResult -> SDL_AsyncIOResult -> Bool)
-> (SDL_AsyncIOResult -> SDL_AsyncIOResult -> Bool)
-> (SDL_AsyncIOResult -> SDL_AsyncIOResult -> SDL_AsyncIOResult)
-> (SDL_AsyncIOResult -> SDL_AsyncIOResult -> SDL_AsyncIOResult)
-> Ord SDL_AsyncIOResult
SDL_AsyncIOResult -> SDL_AsyncIOResult -> Bool
SDL_AsyncIOResult -> SDL_AsyncIOResult -> Ordering
SDL_AsyncIOResult -> SDL_AsyncIOResult -> SDL_AsyncIOResult
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: SDL_AsyncIOResult -> SDL_AsyncIOResult -> Ordering
compare :: SDL_AsyncIOResult -> SDL_AsyncIOResult -> Ordering
$c< :: SDL_AsyncIOResult -> SDL_AsyncIOResult -> Bool
< :: SDL_AsyncIOResult -> SDL_AsyncIOResult -> Bool
$c<= :: SDL_AsyncIOResult -> SDL_AsyncIOResult -> Bool
<= :: SDL_AsyncIOResult -> SDL_AsyncIOResult -> Bool
$c> :: SDL_AsyncIOResult -> SDL_AsyncIOResult -> Bool
> :: SDL_AsyncIOResult -> SDL_AsyncIOResult -> Bool
$c>= :: SDL_AsyncIOResult -> SDL_AsyncIOResult -> Bool
>= :: SDL_AsyncIOResult -> SDL_AsyncIOResult -> Bool
$cmax :: SDL_AsyncIOResult -> SDL_AsyncIOResult -> SDL_AsyncIOResult
max :: SDL_AsyncIOResult -> SDL_AsyncIOResult -> SDL_AsyncIOResult
$cmin :: SDL_AsyncIOResult -> SDL_AsyncIOResult -> SDL_AsyncIOResult
min :: SDL_AsyncIOResult -> SDL_AsyncIOResult -> SDL_AsyncIOResult
Ord)
  deriving newtype (FFIType SDL_AsyncIOResult -> SDL_AsyncIOResult
SDL_AsyncIOResult -> FFIType SDL_AsyncIOResult
(SDL_AsyncIOResult -> FFIType SDL_AsyncIOResult)
-> (FFIType SDL_AsyncIOResult -> SDL_AsyncIOResult)
-> HasFFIType SDL_AsyncIOResult
forall a. (a -> FFIType a) -> (FFIType a -> a) -> HasFFIType a
$ctoFFIType :: SDL_AsyncIOResult -> FFIType SDL_AsyncIOResult
toFFIType :: SDL_AsyncIOResult -> FFIType SDL_AsyncIOResult
$cfromFFIType :: FFIType SDL_AsyncIOResult -> SDL_AsyncIOResult
fromFFIType :: FFIType SDL_AsyncIOResult -> SDL_AsyncIOResult
BG.HasFFIType)

instance Marshal.StaticSize SDL_AsyncIOResult where
  staticSizeOf :: Proxy SDL_AsyncIOResult -> Int
staticSizeOf = \Proxy SDL_AsyncIOResult
_ -> (Int
4 :: Int)

  staticAlignment :: Proxy SDL_AsyncIOResult -> Int
staticAlignment = \Proxy SDL_AsyncIOResult
_ -> (Int
4 :: Int)

instance Marshal.ReadRaw SDL_AsyncIOResult where
  readRaw :: Ptr SDL_AsyncIOResult -> IO SDL_AsyncIOResult
readRaw =
    \Ptr SDL_AsyncIOResult
ptr0 ->
      (CUInt -> SDL_AsyncIOResult) -> IO (CUInt -> SDL_AsyncIOResult)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure CUInt -> SDL_AsyncIOResult
SDL_AsyncIOResult
        IO (CUInt -> SDL_AsyncIOResult) -> IO CUInt -> IO SDL_AsyncIOResult
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Ptr SDL_AsyncIOResult -> Int -> IO CUInt
forall a b. ReadRaw a => Ptr b -> Int -> IO a
Marshal.readRawByteOff Ptr SDL_AsyncIOResult
ptr0 (Int
0 :: Int)

instance Marshal.WriteRaw SDL_AsyncIOResult where
  writeRaw :: Ptr SDL_AsyncIOResult -> SDL_AsyncIOResult -> IO ()
writeRaw =
    \Ptr SDL_AsyncIOResult
ptr0 ->
      \SDL_AsyncIOResult
s1 ->
        case SDL_AsyncIOResult
s1 of
          SDL_AsyncIOResult CUInt
unwrap2 ->
            Ptr SDL_AsyncIOResult -> Int -> CUInt -> IO ()
forall a b. WriteRaw a => Ptr b -> Int -> a -> IO ()
Marshal.writeRawByteOff Ptr SDL_AsyncIOResult
ptr0 (Int
0 :: Int) CUInt
unwrap2

deriving via Marshal.EquivStorable SDL_AsyncIOResult instance BG.Storable SDL_AsyncIOResult

deriving via BG.CUInt instance BG.Prim SDL_AsyncIOResult

instance CEnum.CEnum SDL_AsyncIOResult where
  type CEnumZ SDL_AsyncIOResult = BG.CUInt

  toCEnum :: CEnumZ SDL_AsyncIOResult -> SDL_AsyncIOResult
toCEnum = CUInt -> SDL_AsyncIOResult
CEnumZ SDL_AsyncIOResult -> SDL_AsyncIOResult
SDL_AsyncIOResult

  fromCEnum :: SDL_AsyncIOResult -> CEnumZ SDL_AsyncIOResult
fromCEnum = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"unwrap"

  declaredValues :: forall (proxy :: * -> *).
proxy SDL_AsyncIOResult -> DeclaredValues SDL_AsyncIOResult
declaredValues =
    \proxy SDL_AsyncIOResult
_ ->
      [(CEnumZ SDL_AsyncIOResult, NonEmpty String)]
-> DeclaredValues SDL_AsyncIOResult
forall a.
Ord (CEnumZ a) =>
[(CEnumZ a, NonEmpty String)] -> DeclaredValues a
CEnum.declaredValuesFromList
        [ (CUInt
CEnumZ SDL_AsyncIOResult
0, String -> NonEmpty String
forall a. a -> NonEmpty a
BG.singleton String
"SDL_ASYNCIO_COMPLETE")
        , (CUInt
CEnumZ SDL_AsyncIOResult
1, String -> NonEmpty String
forall a. a -> NonEmpty a
BG.singleton String
"SDL_ASYNCIO_FAILURE")
        , (CUInt
CEnumZ SDL_AsyncIOResult
2, String -> NonEmpty String
forall a. a -> NonEmpty a
BG.singleton String
"SDL_ASYNCIO_CANCELED")
        ]

  showsUndeclared :: forall (proxy :: * -> *).
proxy SDL_AsyncIOResult -> Int -> CEnumZ SDL_AsyncIOResult -> ShowS
showsUndeclared =
    String
-> proxy SDL_AsyncIOResult
-> Int
-> CEnumZ SDL_AsyncIOResult
-> ShowS
forall a (proxy :: * -> *).
Show (CEnumZ a) =>
String -> proxy a -> Int -> CEnumZ a -> ShowS
CEnum.showsWrappedUndeclared String
"SDL_AsyncIOResult"

  readPrecUndeclared :: ReadPrec SDL_AsyncIOResult
readPrecUndeclared =
    String -> ReadPrec SDL_AsyncIOResult
forall a. (CEnum a, Read (CEnumZ a)) => String -> ReadPrec a
CEnum.readPrecWrappedUndeclared String
"SDL_AsyncIOResult"

  isDeclared :: SDL_AsyncIOResult -> Bool
isDeclared = SDL_AsyncIOResult -> Bool
forall a. SequentialCEnum a => a -> Bool
CEnum.seqIsDeclared

  mkDeclared :: CEnumZ SDL_AsyncIOResult -> Maybe SDL_AsyncIOResult
mkDeclared = CEnumZ SDL_AsyncIOResult -> Maybe SDL_AsyncIOResult
forall a. SequentialCEnum a => CEnumZ a -> Maybe a
CEnum.seqMkDeclared

instance CEnum.SequentialCEnum SDL_AsyncIOResult where
  minDeclaredValue :: SDL_AsyncIOResult
minDeclaredValue = SDL_AsyncIOResult
SDL_ASYNCIO_COMPLETE

  maxDeclaredValue :: SDL_AsyncIOResult
maxDeclaredValue = SDL_AsyncIOResult
SDL_ASYNCIO_CANCELED

instance Show SDL_AsyncIOResult where
  showsPrec :: Int -> SDL_AsyncIOResult -> ShowS
showsPrec = Int -> SDL_AsyncIOResult -> ShowS
forall a. CEnum a => Int -> a -> ShowS
CEnum.shows

instance Read SDL_AsyncIOResult where
  readPrec :: ReadPrec SDL_AsyncIOResult
readPrec = ReadPrec SDL_AsyncIOResult
forall a. CEnum a => ReadPrec a
CEnum.readPrec

  readList :: ReadS [SDL_AsyncIOResult]
readList = ReadS [SDL_AsyncIOResult]
forall a. Read a => ReadS [a]
BG.readListDefault

  readListPrec :: ReadPrec [SDL_AsyncIOResult]
readListPrec = ReadPrec [SDL_AsyncIOResult]
forall a. Read a => ReadPrec [a]
BG.readListPrecDefault

instance
  (ty ~ BG.CUInt)
  => BG.CompatHasField.HasField "unwrap" SDL_AsyncIOResult ty
  where
  hasField :: SDL_AsyncIOResult -> (ty -> SDL_AsyncIOResult, ty)
hasField =
    \SDL_AsyncIOResult
x0 ->
      ( \ty
y1 ->
          SDL_AsyncIOResult{unwrap :: CUInt
unwrap = ty
CUInt
y1}
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"unwrap" SDL_AsyncIOResult
x0
      )

instance
  (ty ~ BG.CUInt)
  => BG.HasField "unwrap" (BG.Ptr SDL_AsyncIOResult) (BG.Ptr ty)
  where
  getField :: Ptr SDL_AsyncIOResult -> Ptr ty
getField = Proxy "unwrap"
-> Ptr SDL_AsyncIOResult
-> Ptr (CFieldType SDL_AsyncIOResult "unwrap")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"unwrap")

instance HasCField.HasCField SDL_AsyncIOResult "unwrap" where
  type CFieldType SDL_AsyncIOResult "unwrap" = BG.CUInt

  offset# :: Proxy# SDL_AsyncIOResult -> Proxy# "unwrap" -> Int
offset# = \Proxy# SDL_AsyncIOResult
_ -> \Proxy# "unwrap"
_ -> Int
0

-- | request was completed without error
--
--     [C declaration]: @SDL_ASYNCIO_COMPLETE@, defined at @SDL3\/SDL_asyncio.h 145:5@
pattern SDL_ASYNCIO_COMPLETE :: SDL_AsyncIOResult
pattern $mSDL_ASYNCIO_COMPLETE :: forall {r}. SDL_AsyncIOResult -> ((# #) -> r) -> ((# #) -> r) -> r
$bSDL_ASYNCIO_COMPLETE :: SDL_AsyncIOResult
SDL_ASYNCIO_COMPLETE = SDL_AsyncIOResult 0

-- | request failed for some reason; check SDL_GetError()!
--
--     [C declaration]: @SDL_ASYNCIO_FAILURE@, defined at @SDL3\/SDL_asyncio.h 146:5@
pattern SDL_ASYNCIO_FAILURE :: SDL_AsyncIOResult
pattern $mSDL_ASYNCIO_FAILURE :: forall {r}. SDL_AsyncIOResult -> ((# #) -> r) -> ((# #) -> r) -> r
$bSDL_ASYNCIO_FAILURE :: SDL_AsyncIOResult
SDL_ASYNCIO_FAILURE = SDL_AsyncIOResult 1

-- | request was canceled before completing.
--
--     [C declaration]: @SDL_ASYNCIO_CANCELED@, defined at @SDL3\/SDL_asyncio.h 147:5@
pattern SDL_ASYNCIO_CANCELED :: SDL_AsyncIOResult
pattern $mSDL_ASYNCIO_CANCELED :: forall {r}. SDL_AsyncIOResult -> ((# #) -> r) -> ((# #) -> r) -> r
$bSDL_ASYNCIO_CANCELED :: SDL_AsyncIOResult
SDL_ASYNCIO_CANCELED = SDL_AsyncIOResult 2

-- | Information about a completed asynchronous I\/O request.
--
--     @since 3.2.0
--
--     [C declaration]: @struct SDL_AsyncIOOutcome@, defined at @SDL3\/SDL_asyncio.h 155:16@
data SDL_AsyncIOOutcome = SDL_AsyncIOOutcome
  { SDL_AsyncIOOutcome -> Ptr SDL_AsyncIO
asyncio :: BG.Ptr SDL_AsyncIO
  -- ^ what generated this task. This pointer will be invalid if it was closed!
  --
  --          [C declaration]: @asyncio@, defined at @SDL3\/SDL_asyncio.h 157:18@
  , SDL_AsyncIOOutcome -> SDL_AsyncIOTaskType
type' :: SDL_AsyncIOTaskType
  -- ^ What sort of task was this? Read, write, etc?
  --
  --          [C declaration]: @type@, defined at @SDL3\/SDL_asyncio.h 158:25@
  , SDL_AsyncIOOutcome -> SDL_AsyncIOResult
result :: SDL_AsyncIOResult
  -- ^ the result of the work (success, failure, cancellation).
  --
  --          [C declaration]: @result@, defined at @SDL3\/SDL_asyncio.h 159:23@
  , SDL_AsyncIOOutcome -> Ptr Void
buffer :: BG.Ptr BG.Void
  -- ^ buffer where data was read\/written.
  --
  --          [C declaration]: @buffer@, defined at @SDL3\/SDL_asyncio.h 160:11@
  , SDL_AsyncIOOutcome -> Uint64
offset :: SDL3.Sys.Bindgen.Stdinc.Uint64
  -- ^ offset in the 'SDL_AsyncIO' where data was read\/written.
  --
  --          [C declaration]: @offset@, defined at @SDL3\/SDL_asyncio.h 161:12@
  , SDL_AsyncIOOutcome -> Uint64
bytes_requested :: SDL3.Sys.Bindgen.Stdinc.Uint64
  -- ^ number of bytes the task was to read\/write.
  --
  --          [C declaration]: @bytes_requested@, defined at @SDL3\/SDL_asyncio.h 162:12@
  , SDL_AsyncIOOutcome -> Uint64
bytes_transferred :: SDL3.Sys.Bindgen.Stdinc.Uint64
  -- ^ actual number of bytes that were read\/written.
  --
  --          [C declaration]: @bytes_transferred@, defined at @SDL3\/SDL_asyncio.h 163:12@
  , SDL_AsyncIOOutcome -> Ptr Void
userdata :: BG.Ptr BG.Void
  -- ^ pointer provided by the app when starting the task
  --
  --          [C declaration]: @userdata@, defined at @SDL3\/SDL_asyncio.h 164:11@
  }
  deriving stock ((forall x. SDL_AsyncIOOutcome -> Rep SDL_AsyncIOOutcome x)
-> (forall x. Rep SDL_AsyncIOOutcome x -> SDL_AsyncIOOutcome)
-> Generic SDL_AsyncIOOutcome
forall x. Rep SDL_AsyncIOOutcome x -> SDL_AsyncIOOutcome
forall x. SDL_AsyncIOOutcome -> Rep SDL_AsyncIOOutcome x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SDL_AsyncIOOutcome -> Rep SDL_AsyncIOOutcome x
from :: forall x. SDL_AsyncIOOutcome -> Rep SDL_AsyncIOOutcome x
$cto :: forall x. Rep SDL_AsyncIOOutcome x -> SDL_AsyncIOOutcome
to :: forall x. Rep SDL_AsyncIOOutcome x -> SDL_AsyncIOOutcome
BG.Generic, SDL_AsyncIOOutcome -> SDL_AsyncIOOutcome -> Bool
(SDL_AsyncIOOutcome -> SDL_AsyncIOOutcome -> Bool)
-> (SDL_AsyncIOOutcome -> SDL_AsyncIOOutcome -> Bool)
-> Eq SDL_AsyncIOOutcome
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SDL_AsyncIOOutcome -> SDL_AsyncIOOutcome -> Bool
== :: SDL_AsyncIOOutcome -> SDL_AsyncIOOutcome -> Bool
$c/= :: SDL_AsyncIOOutcome -> SDL_AsyncIOOutcome -> Bool
/= :: SDL_AsyncIOOutcome -> SDL_AsyncIOOutcome -> Bool
Eq, Int -> SDL_AsyncIOOutcome -> ShowS
[SDL_AsyncIOOutcome] -> ShowS
SDL_AsyncIOOutcome -> String
(Int -> SDL_AsyncIOOutcome -> ShowS)
-> (SDL_AsyncIOOutcome -> String)
-> ([SDL_AsyncIOOutcome] -> ShowS)
-> Show SDL_AsyncIOOutcome
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SDL_AsyncIOOutcome -> ShowS
showsPrec :: Int -> SDL_AsyncIOOutcome -> ShowS
$cshow :: SDL_AsyncIOOutcome -> String
show :: SDL_AsyncIOOutcome -> String
$cshowList :: [SDL_AsyncIOOutcome] -> ShowS
showList :: [SDL_AsyncIOOutcome] -> ShowS
Show)

instance Marshal.StaticSize SDL_AsyncIOOutcome where
  staticSizeOf :: Proxy SDL_AsyncIOOutcome -> Int
staticSizeOf = \Proxy SDL_AsyncIOOutcome
_ -> (Int
56 :: Int)

  staticAlignment :: Proxy SDL_AsyncIOOutcome -> Int
staticAlignment = \Proxy SDL_AsyncIOOutcome
_ -> (Int
8 :: Int)

instance Marshal.ReadRaw SDL_AsyncIOOutcome where
  readRaw :: Ptr SDL_AsyncIOOutcome -> IO SDL_AsyncIOOutcome
readRaw =
    \Ptr SDL_AsyncIOOutcome
ptr0 ->
      (Ptr SDL_AsyncIO
 -> SDL_AsyncIOTaskType
 -> SDL_AsyncIOResult
 -> Ptr Void
 -> Uint64
 -> Uint64
 -> Uint64
 -> Ptr Void
 -> SDL_AsyncIOOutcome)
-> IO
     (Ptr SDL_AsyncIO
      -> SDL_AsyncIOTaskType
      -> SDL_AsyncIOResult
      -> Ptr Void
      -> Uint64
      -> Uint64
      -> Uint64
      -> Ptr Void
      -> SDL_AsyncIOOutcome)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Ptr SDL_AsyncIO
-> SDL_AsyncIOTaskType
-> SDL_AsyncIOResult
-> Ptr Void
-> Uint64
-> Uint64
-> Uint64
-> Ptr Void
-> SDL_AsyncIOOutcome
SDL_AsyncIOOutcome
        IO
  (Ptr SDL_AsyncIO
   -> SDL_AsyncIOTaskType
   -> SDL_AsyncIOResult
   -> Ptr Void
   -> Uint64
   -> Uint64
   -> Uint64
   -> Ptr Void
   -> SDL_AsyncIOOutcome)
-> IO (Ptr SDL_AsyncIO)
-> IO
     (SDL_AsyncIOTaskType
      -> SDL_AsyncIOResult
      -> Ptr Void
      -> Uint64
      -> Uint64
      -> Uint64
      -> Ptr Void
      -> SDL_AsyncIOOutcome)
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy "asyncio"
-> Ptr SDL_AsyncIOOutcome
-> IO (CFieldType SDL_AsyncIOOutcome "asyncio")
forall a (field :: Symbol).
(HasCField a field, ReadRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> IO (CFieldType a field)
HasCField.readRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"asyncio") Ptr SDL_AsyncIOOutcome
ptr0
        IO
  (SDL_AsyncIOTaskType
   -> SDL_AsyncIOResult
   -> Ptr Void
   -> Uint64
   -> Uint64
   -> Uint64
   -> Ptr Void
   -> SDL_AsyncIOOutcome)
-> IO SDL_AsyncIOTaskType
-> IO
     (SDL_AsyncIOResult
      -> Ptr Void
      -> Uint64
      -> Uint64
      -> Uint64
      -> Ptr Void
      -> SDL_AsyncIOOutcome)
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy "type'"
-> Ptr SDL_AsyncIOOutcome
-> IO (CFieldType SDL_AsyncIOOutcome "type'")
forall a (field :: Symbol).
(HasCField a field, ReadRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> IO (CFieldType a field)
HasCField.readRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"type'") Ptr SDL_AsyncIOOutcome
ptr0
        IO
  (SDL_AsyncIOResult
   -> Ptr Void
   -> Uint64
   -> Uint64
   -> Uint64
   -> Ptr Void
   -> SDL_AsyncIOOutcome)
-> IO SDL_AsyncIOResult
-> IO
     (Ptr Void
      -> Uint64 -> Uint64 -> Uint64 -> Ptr Void -> SDL_AsyncIOOutcome)
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy "result"
-> Ptr SDL_AsyncIOOutcome
-> IO (CFieldType SDL_AsyncIOOutcome "result")
forall a (field :: Symbol).
(HasCField a field, ReadRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> IO (CFieldType a field)
HasCField.readRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"result") Ptr SDL_AsyncIOOutcome
ptr0
        IO
  (Ptr Void
   -> Uint64 -> Uint64 -> Uint64 -> Ptr Void -> SDL_AsyncIOOutcome)
-> IO (Ptr Void)
-> IO
     (Uint64 -> Uint64 -> Uint64 -> Ptr Void -> SDL_AsyncIOOutcome)
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy "buffer"
-> Ptr SDL_AsyncIOOutcome
-> IO (CFieldType SDL_AsyncIOOutcome "buffer")
forall a (field :: Symbol).
(HasCField a field, ReadRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> IO (CFieldType a field)
HasCField.readRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"buffer") Ptr SDL_AsyncIOOutcome
ptr0
        IO (Uint64 -> Uint64 -> Uint64 -> Ptr Void -> SDL_AsyncIOOutcome)
-> IO Uint64
-> IO (Uint64 -> Uint64 -> Ptr Void -> SDL_AsyncIOOutcome)
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy "offset"
-> Ptr SDL_AsyncIOOutcome
-> IO (CFieldType SDL_AsyncIOOutcome "offset")
forall a (field :: Symbol).
(HasCField a field, ReadRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> IO (CFieldType a field)
HasCField.readRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"offset") Ptr SDL_AsyncIOOutcome
ptr0
        IO (Uint64 -> Uint64 -> Ptr Void -> SDL_AsyncIOOutcome)
-> IO Uint64 -> IO (Uint64 -> Ptr Void -> SDL_AsyncIOOutcome)
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy "bytes_requested"
-> Ptr SDL_AsyncIOOutcome
-> IO (CFieldType SDL_AsyncIOOutcome "bytes_requested")
forall a (field :: Symbol).
(HasCField a field, ReadRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> IO (CFieldType a field)
HasCField.readRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"bytes_requested") Ptr SDL_AsyncIOOutcome
ptr0
        IO (Uint64 -> Ptr Void -> SDL_AsyncIOOutcome)
-> IO Uint64 -> IO (Ptr Void -> SDL_AsyncIOOutcome)
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy "bytes_transferred"
-> Ptr SDL_AsyncIOOutcome
-> IO (CFieldType SDL_AsyncIOOutcome "bytes_transferred")
forall a (field :: Symbol).
(HasCField a field, ReadRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> IO (CFieldType a field)
HasCField.readRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"bytes_transferred") Ptr SDL_AsyncIOOutcome
ptr0
        IO (Ptr Void -> SDL_AsyncIOOutcome)
-> IO (Ptr Void) -> IO SDL_AsyncIOOutcome
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy "userdata"
-> Ptr SDL_AsyncIOOutcome
-> IO (CFieldType SDL_AsyncIOOutcome "userdata")
forall a (field :: Symbol).
(HasCField a field, ReadRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> IO (CFieldType a field)
HasCField.readRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"userdata") Ptr SDL_AsyncIOOutcome
ptr0

instance Marshal.WriteRaw SDL_AsyncIOOutcome where
  writeRaw :: Ptr SDL_AsyncIOOutcome -> SDL_AsyncIOOutcome -> IO ()
writeRaw =
    \Ptr SDL_AsyncIOOutcome
ptr0 ->
      \SDL_AsyncIOOutcome
s1 ->
        case SDL_AsyncIOOutcome
s1 of
          SDL_AsyncIOOutcome
            Ptr SDL_AsyncIO
asyncio2
            SDL_AsyncIOTaskType
type'3
            SDL_AsyncIOResult
result4
            Ptr Void
buffer5
            Uint64
offset6
            Uint64
bytes_requested7
            Uint64
bytes_transferred8
            Ptr Void
userdata9 ->
              Proxy "asyncio"
-> Ptr SDL_AsyncIOOutcome
-> CFieldType SDL_AsyncIOOutcome "asyncio"
-> IO ()
forall a (field :: Symbol).
(HasCField a field, WriteRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> CFieldType a field -> IO ()
HasCField.writeRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"asyncio") Ptr SDL_AsyncIOOutcome
ptr0 Ptr SDL_AsyncIO
CFieldType SDL_AsyncIOOutcome "asyncio"
asyncio2
                IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Proxy "type'"
-> Ptr SDL_AsyncIOOutcome
-> CFieldType SDL_AsyncIOOutcome "type'"
-> IO ()
forall a (field :: Symbol).
(HasCField a field, WriteRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> CFieldType a field -> IO ()
HasCField.writeRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"type'") Ptr SDL_AsyncIOOutcome
ptr0 CFieldType SDL_AsyncIOOutcome "type'"
SDL_AsyncIOTaskType
type'3
                IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Proxy "result"
-> Ptr SDL_AsyncIOOutcome
-> CFieldType SDL_AsyncIOOutcome "result"
-> IO ()
forall a (field :: Symbol).
(HasCField a field, WriteRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> CFieldType a field -> IO ()
HasCField.writeRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"result") Ptr SDL_AsyncIOOutcome
ptr0 CFieldType SDL_AsyncIOOutcome "result"
SDL_AsyncIOResult
result4
                IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Proxy "buffer"
-> Ptr SDL_AsyncIOOutcome
-> CFieldType SDL_AsyncIOOutcome "buffer"
-> IO ()
forall a (field :: Symbol).
(HasCField a field, WriteRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> CFieldType a field -> IO ()
HasCField.writeRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"buffer") Ptr SDL_AsyncIOOutcome
ptr0 Ptr Void
CFieldType SDL_AsyncIOOutcome "buffer"
buffer5
                IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Proxy "offset"
-> Ptr SDL_AsyncIOOutcome
-> CFieldType SDL_AsyncIOOutcome "offset"
-> IO ()
forall a (field :: Symbol).
(HasCField a field, WriteRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> CFieldType a field -> IO ()
HasCField.writeRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"offset") Ptr SDL_AsyncIOOutcome
ptr0 CFieldType SDL_AsyncIOOutcome "offset"
Uint64
offset6
                IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Proxy "bytes_requested"
-> Ptr SDL_AsyncIOOutcome
-> CFieldType SDL_AsyncIOOutcome "bytes_requested"
-> IO ()
forall a (field :: Symbol).
(HasCField a field, WriteRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> CFieldType a field -> IO ()
HasCField.writeRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"bytes_requested") Ptr SDL_AsyncIOOutcome
ptr0 CFieldType SDL_AsyncIOOutcome "bytes_requested"
Uint64
bytes_requested7
                IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Proxy "bytes_transferred"
-> Ptr SDL_AsyncIOOutcome
-> CFieldType SDL_AsyncIOOutcome "bytes_transferred"
-> IO ()
forall a (field :: Symbol).
(HasCField a field, WriteRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> CFieldType a field -> IO ()
HasCField.writeRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"bytes_transferred") Ptr SDL_AsyncIOOutcome
ptr0 CFieldType SDL_AsyncIOOutcome "bytes_transferred"
Uint64
bytes_transferred8
                IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Proxy "userdata"
-> Ptr SDL_AsyncIOOutcome
-> CFieldType SDL_AsyncIOOutcome "userdata"
-> IO ()
forall a (field :: Symbol).
(HasCField a field, WriteRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> CFieldType a field -> IO ()
HasCField.writeRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"userdata") Ptr SDL_AsyncIOOutcome
ptr0 Ptr Void
CFieldType SDL_AsyncIOOutcome "userdata"
userdata9

deriving via Marshal.EquivStorable SDL_AsyncIOOutcome instance BG.Storable SDL_AsyncIOOutcome

deriving via
  Struct.IsStructViaReadRaw SDL_AsyncIOOutcome
  instance
    Struct.IsStruct SDL_AsyncIOOutcome

-- | what generated this task. This pointer will be invalid if it was closed!
--
--     [C declaration]: @asyncio@, defined at @SDL3\/SDL_asyncio.h 157:18@
instance
  (ty ~ BG.Ptr SDL_AsyncIO)
  => BG.CompatHasField.HasField "asyncio" SDL_AsyncIOOutcome ty
  where
  hasField :: SDL_AsyncIOOutcome -> (ty -> SDL_AsyncIOOutcome, ty)
hasField =
    \SDL_AsyncIOOutcome
x0 ->
      ( \ty
y1 ->
          SDL_AsyncIOOutcome
            { asyncio :: Ptr SDL_AsyncIO
asyncio = ty
Ptr SDL_AsyncIO
y1
            , type' :: SDL_AsyncIOTaskType
type' = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"type'" SDL_AsyncIOOutcome
x0
            , result :: SDL_AsyncIOResult
result = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"result" SDL_AsyncIOOutcome
x0
            , buffer :: Ptr Void
buffer = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"buffer" SDL_AsyncIOOutcome
x0
            , offset :: Uint64
offset = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"offset" SDL_AsyncIOOutcome
x0
            , bytes_requested :: Uint64
bytes_requested = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"bytes_requested" SDL_AsyncIOOutcome
x0
            , bytes_transferred :: Uint64
bytes_transferred = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"bytes_transferred" SDL_AsyncIOOutcome
x0
            , userdata :: Ptr Void
userdata = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"userdata" SDL_AsyncIOOutcome
x0
            }
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"asyncio" SDL_AsyncIOOutcome
x0
      )

instance
  (ty ~ BG.Ptr SDL_AsyncIO)
  => BG.HasField "asyncio" (BG.Ptr SDL_AsyncIOOutcome) (BG.Ptr ty)
  where
  getField :: Ptr SDL_AsyncIOOutcome -> Ptr ty
getField = Proxy "asyncio"
-> Ptr SDL_AsyncIOOutcome
-> Ptr (CFieldType SDL_AsyncIOOutcome "asyncio")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"asyncio")

instance HasCField.HasCField SDL_AsyncIOOutcome "asyncio" where
  type
    CFieldType SDL_AsyncIOOutcome "asyncio" =
      BG.Ptr SDL_AsyncIO

  offset# :: Proxy# SDL_AsyncIOOutcome -> Proxy# "asyncio" -> Int
offset# = \Proxy# SDL_AsyncIOOutcome
_ -> \Proxy# "asyncio"
_ -> Int
0

-- | What sort of task was this? Read, write, etc?
--
--     [C declaration]: @type@, defined at @SDL3\/SDL_asyncio.h 158:25@
instance
  (ty ~ SDL_AsyncIOTaskType)
  => BG.CompatHasField.HasField "type'" SDL_AsyncIOOutcome ty
  where
  hasField :: SDL_AsyncIOOutcome -> (ty -> SDL_AsyncIOOutcome, ty)
hasField =
    \SDL_AsyncIOOutcome
x0 ->
      ( \ty
y1 ->
          SDL_AsyncIOOutcome
            { type' :: SDL_AsyncIOTaskType
type' = ty
SDL_AsyncIOTaskType
y1
            , asyncio :: Ptr SDL_AsyncIO
asyncio = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"asyncio" SDL_AsyncIOOutcome
x0
            , result :: SDL_AsyncIOResult
result = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"result" SDL_AsyncIOOutcome
x0
            , buffer :: Ptr Void
buffer = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"buffer" SDL_AsyncIOOutcome
x0
            , offset :: Uint64
offset = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"offset" SDL_AsyncIOOutcome
x0
            , bytes_requested :: Uint64
bytes_requested = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"bytes_requested" SDL_AsyncIOOutcome
x0
            , bytes_transferred :: Uint64
bytes_transferred = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"bytes_transferred" SDL_AsyncIOOutcome
x0
            , userdata :: Ptr Void
userdata = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"userdata" SDL_AsyncIOOutcome
x0
            }
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"type'" SDL_AsyncIOOutcome
x0
      )

instance
  (ty ~ SDL_AsyncIOTaskType)
  => BG.HasField "type'" (BG.Ptr SDL_AsyncIOOutcome) (BG.Ptr ty)
  where
  getField :: Ptr SDL_AsyncIOOutcome -> Ptr ty
getField = Proxy "type'"
-> Ptr SDL_AsyncIOOutcome
-> Ptr (CFieldType SDL_AsyncIOOutcome "type'")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"type'")

instance HasCField.HasCField SDL_AsyncIOOutcome "type'" where
  type
    CFieldType SDL_AsyncIOOutcome "type'" =
      SDL_AsyncIOTaskType

  offset# :: Proxy# SDL_AsyncIOOutcome -> Proxy# "type'" -> Int
offset# = \Proxy# SDL_AsyncIOOutcome
_ -> \Proxy# "type'"
_ -> Int
8

-- | the result of the work (success, failure, cancellation).
--
--     [C declaration]: @result@, defined at @SDL3\/SDL_asyncio.h 159:23@
instance
  (ty ~ SDL_AsyncIOResult)
  => BG.CompatHasField.HasField "result" SDL_AsyncIOOutcome ty
  where
  hasField :: SDL_AsyncIOOutcome -> (ty -> SDL_AsyncIOOutcome, ty)
hasField =
    \SDL_AsyncIOOutcome
x0 ->
      ( \ty
y1 ->
          SDL_AsyncIOOutcome
            { result :: SDL_AsyncIOResult
result = ty
SDL_AsyncIOResult
y1
            , asyncio :: Ptr SDL_AsyncIO
asyncio = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"asyncio" SDL_AsyncIOOutcome
x0
            , type' :: SDL_AsyncIOTaskType
type' = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"type'" SDL_AsyncIOOutcome
x0
            , buffer :: Ptr Void
buffer = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"buffer" SDL_AsyncIOOutcome
x0
            , offset :: Uint64
offset = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"offset" SDL_AsyncIOOutcome
x0
            , bytes_requested :: Uint64
bytes_requested = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"bytes_requested" SDL_AsyncIOOutcome
x0
            , bytes_transferred :: Uint64
bytes_transferred = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"bytes_transferred" SDL_AsyncIOOutcome
x0
            , userdata :: Ptr Void
userdata = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"userdata" SDL_AsyncIOOutcome
x0
            }
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"result" SDL_AsyncIOOutcome
x0
      )

instance
  (ty ~ SDL_AsyncIOResult)
  => BG.HasField "result" (BG.Ptr SDL_AsyncIOOutcome) (BG.Ptr ty)
  where
  getField :: Ptr SDL_AsyncIOOutcome -> Ptr ty
getField = Proxy "result"
-> Ptr SDL_AsyncIOOutcome
-> Ptr (CFieldType SDL_AsyncIOOutcome "result")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"result")

instance HasCField.HasCField SDL_AsyncIOOutcome "result" where
  type
    CFieldType SDL_AsyncIOOutcome "result" =
      SDL_AsyncIOResult

  offset# :: Proxy# SDL_AsyncIOOutcome -> Proxy# "result" -> Int
offset# = \Proxy# SDL_AsyncIOOutcome
_ -> \Proxy# "result"
_ -> Int
12

-- | buffer where data was read\/written.
--
--     [C declaration]: @buffer@, defined at @SDL3\/SDL_asyncio.h 160:11@
instance
  (ty ~ BG.Ptr BG.Void)
  => BG.CompatHasField.HasField "buffer" SDL_AsyncIOOutcome ty
  where
  hasField :: SDL_AsyncIOOutcome -> (ty -> SDL_AsyncIOOutcome, ty)
hasField =
    \SDL_AsyncIOOutcome
x0 ->
      ( \ty
y1 ->
          SDL_AsyncIOOutcome
            { buffer :: Ptr Void
buffer = ty
Ptr Void
y1
            , asyncio :: Ptr SDL_AsyncIO
asyncio = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"asyncio" SDL_AsyncIOOutcome
x0
            , type' :: SDL_AsyncIOTaskType
type' = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"type'" SDL_AsyncIOOutcome
x0
            , result :: SDL_AsyncIOResult
result = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"result" SDL_AsyncIOOutcome
x0
            , offset :: Uint64
offset = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"offset" SDL_AsyncIOOutcome
x0
            , bytes_requested :: Uint64
bytes_requested = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"bytes_requested" SDL_AsyncIOOutcome
x0
            , bytes_transferred :: Uint64
bytes_transferred = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"bytes_transferred" SDL_AsyncIOOutcome
x0
            , userdata :: Ptr Void
userdata = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"userdata" SDL_AsyncIOOutcome
x0
            }
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"buffer" SDL_AsyncIOOutcome
x0
      )

instance
  (ty ~ BG.Ptr BG.Void)
  => BG.HasField "buffer" (BG.Ptr SDL_AsyncIOOutcome) (BG.Ptr ty)
  where
  getField :: Ptr SDL_AsyncIOOutcome -> Ptr ty
getField = Proxy "buffer"
-> Ptr SDL_AsyncIOOutcome
-> Ptr (CFieldType SDL_AsyncIOOutcome "buffer")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"buffer")

instance HasCField.HasCField SDL_AsyncIOOutcome "buffer" where
  type
    CFieldType SDL_AsyncIOOutcome "buffer" =
      BG.Ptr BG.Void

  offset# :: Proxy# SDL_AsyncIOOutcome -> Proxy# "buffer" -> Int
offset# = \Proxy# SDL_AsyncIOOutcome
_ -> \Proxy# "buffer"
_ -> Int
16

-- | offset in the 'SDL_AsyncIO' where data was read\/written.
--
--     [C declaration]: @offset@, defined at @SDL3\/SDL_asyncio.h 161:12@
instance
  (ty ~ SDL3.Sys.Bindgen.Stdinc.Uint64)
  => BG.CompatHasField.HasField "offset" SDL_AsyncIOOutcome ty
  where
  hasField :: SDL_AsyncIOOutcome -> (ty -> SDL_AsyncIOOutcome, ty)
hasField =
    \SDL_AsyncIOOutcome
x0 ->
      ( \ty
y1 ->
          SDL_AsyncIOOutcome
            { offset :: Uint64
offset = ty
Uint64
y1
            , asyncio :: Ptr SDL_AsyncIO
asyncio = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"asyncio" SDL_AsyncIOOutcome
x0
            , type' :: SDL_AsyncIOTaskType
type' = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"type'" SDL_AsyncIOOutcome
x0
            , result :: SDL_AsyncIOResult
result = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"result" SDL_AsyncIOOutcome
x0
            , buffer :: Ptr Void
buffer = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"buffer" SDL_AsyncIOOutcome
x0
            , bytes_requested :: Uint64
bytes_requested = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"bytes_requested" SDL_AsyncIOOutcome
x0
            , bytes_transferred :: Uint64
bytes_transferred = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"bytes_transferred" SDL_AsyncIOOutcome
x0
            , userdata :: Ptr Void
userdata = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"userdata" SDL_AsyncIOOutcome
x0
            }
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"offset" SDL_AsyncIOOutcome
x0
      )

instance
  (ty ~ SDL3.Sys.Bindgen.Stdinc.Uint64)
  => BG.HasField "offset" (BG.Ptr SDL_AsyncIOOutcome) (BG.Ptr ty)
  where
  getField :: Ptr SDL_AsyncIOOutcome -> Ptr ty
getField = Proxy "offset"
-> Ptr SDL_AsyncIOOutcome
-> Ptr (CFieldType SDL_AsyncIOOutcome "offset")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"offset")

instance HasCField.HasCField SDL_AsyncIOOutcome "offset" where
  type
    CFieldType SDL_AsyncIOOutcome "offset" =
      SDL3.Sys.Bindgen.Stdinc.Uint64

  offset# :: Proxy# SDL_AsyncIOOutcome -> Proxy# "offset" -> Int
offset# = \Proxy# SDL_AsyncIOOutcome
_ -> \Proxy# "offset"
_ -> Int
24

-- | number of bytes the task was to read\/write.
--
--     [C declaration]: @bytes_requested@, defined at @SDL3\/SDL_asyncio.h 162:12@
instance
  (ty ~ SDL3.Sys.Bindgen.Stdinc.Uint64)
  => BG.CompatHasField.HasField "bytes_requested" SDL_AsyncIOOutcome ty
  where
  hasField :: SDL_AsyncIOOutcome -> (ty -> SDL_AsyncIOOutcome, ty)
hasField =
    \SDL_AsyncIOOutcome
x0 ->
      ( \ty
y1 ->
          SDL_AsyncIOOutcome
            { bytes_requested :: Uint64
bytes_requested = ty
Uint64
y1
            , asyncio :: Ptr SDL_AsyncIO
asyncio = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"asyncio" SDL_AsyncIOOutcome
x0
            , type' :: SDL_AsyncIOTaskType
type' = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"type'" SDL_AsyncIOOutcome
x0
            , result :: SDL_AsyncIOResult
result = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"result" SDL_AsyncIOOutcome
x0
            , buffer :: Ptr Void
buffer = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"buffer" SDL_AsyncIOOutcome
x0
            , offset :: Uint64
offset = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"offset" SDL_AsyncIOOutcome
x0
            , bytes_transferred :: Uint64
bytes_transferred = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"bytes_transferred" SDL_AsyncIOOutcome
x0
            , userdata :: Ptr Void
userdata = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"userdata" SDL_AsyncIOOutcome
x0
            }
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"bytes_requested" SDL_AsyncIOOutcome
x0
      )

instance
  (ty ~ SDL3.Sys.Bindgen.Stdinc.Uint64)
  => BG.HasField "bytes_requested" (BG.Ptr SDL_AsyncIOOutcome) (BG.Ptr ty)
  where
  getField :: Ptr SDL_AsyncIOOutcome -> Ptr ty
getField =
    Proxy "bytes_requested"
-> Ptr SDL_AsyncIOOutcome
-> Ptr (CFieldType SDL_AsyncIOOutcome "bytes_requested")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"bytes_requested")

instance HasCField.HasCField SDL_AsyncIOOutcome "bytes_requested" where
  type
    CFieldType SDL_AsyncIOOutcome "bytes_requested" =
      SDL3.Sys.Bindgen.Stdinc.Uint64

  offset# :: Proxy# SDL_AsyncIOOutcome -> Proxy# "bytes_requested" -> Int
offset# = \Proxy# SDL_AsyncIOOutcome
_ -> \Proxy# "bytes_requested"
_ -> Int
32

-- | actual number of bytes that were read\/written.
--
--     [C declaration]: @bytes_transferred@, defined at @SDL3\/SDL_asyncio.h 163:12@
instance
  (ty ~ SDL3.Sys.Bindgen.Stdinc.Uint64)
  => BG.CompatHasField.HasField "bytes_transferred" SDL_AsyncIOOutcome ty
  where
  hasField :: SDL_AsyncIOOutcome -> (ty -> SDL_AsyncIOOutcome, ty)
hasField =
    \SDL_AsyncIOOutcome
x0 ->
      ( \ty
y1 ->
          SDL_AsyncIOOutcome
            { bytes_transferred :: Uint64
bytes_transferred = ty
Uint64
y1
            , asyncio :: Ptr SDL_AsyncIO
asyncio = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"asyncio" SDL_AsyncIOOutcome
x0
            , type' :: SDL_AsyncIOTaskType
type' = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"type'" SDL_AsyncIOOutcome
x0
            , result :: SDL_AsyncIOResult
result = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"result" SDL_AsyncIOOutcome
x0
            , buffer :: Ptr Void
buffer = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"buffer" SDL_AsyncIOOutcome
x0
            , offset :: Uint64
offset = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"offset" SDL_AsyncIOOutcome
x0
            , bytes_requested :: Uint64
bytes_requested = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"bytes_requested" SDL_AsyncIOOutcome
x0
            , userdata :: Ptr Void
userdata = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"userdata" SDL_AsyncIOOutcome
x0
            }
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"bytes_transferred" SDL_AsyncIOOutcome
x0
      )

instance
  (ty ~ SDL3.Sys.Bindgen.Stdinc.Uint64)
  => BG.HasField "bytes_transferred" (BG.Ptr SDL_AsyncIOOutcome) (BG.Ptr ty)
  where
  getField :: Ptr SDL_AsyncIOOutcome -> Ptr ty
getField =
    Proxy "bytes_transferred"
-> Ptr SDL_AsyncIOOutcome
-> Ptr (CFieldType SDL_AsyncIOOutcome "bytes_transferred")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"bytes_transferred")

instance HasCField.HasCField SDL_AsyncIOOutcome "bytes_transferred" where
  type
    CFieldType SDL_AsyncIOOutcome "bytes_transferred" =
      SDL3.Sys.Bindgen.Stdinc.Uint64

  offset# :: Proxy# SDL_AsyncIOOutcome -> Proxy# "bytes_transferred" -> Int
offset# = \Proxy# SDL_AsyncIOOutcome
_ -> \Proxy# "bytes_transferred"
_ -> Int
40

-- | pointer provided by the app when starting the task
--
--     [C declaration]: @userdata@, defined at @SDL3\/SDL_asyncio.h 164:11@
instance
  (ty ~ BG.Ptr BG.Void)
  => BG.CompatHasField.HasField "userdata" SDL_AsyncIOOutcome ty
  where
  hasField :: SDL_AsyncIOOutcome -> (ty -> SDL_AsyncIOOutcome, ty)
hasField =
    \SDL_AsyncIOOutcome
x0 ->
      ( \ty
y1 ->
          SDL_AsyncIOOutcome
            { userdata :: Ptr Void
userdata = ty
Ptr Void
y1
            , asyncio :: Ptr SDL_AsyncIO
asyncio = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"asyncio" SDL_AsyncIOOutcome
x0
            , type' :: SDL_AsyncIOTaskType
type' = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"type'" SDL_AsyncIOOutcome
x0
            , result :: SDL_AsyncIOResult
result = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"result" SDL_AsyncIOOutcome
x0
            , buffer :: Ptr Void
buffer = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"buffer" SDL_AsyncIOOutcome
x0
            , offset :: Uint64
offset = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"offset" SDL_AsyncIOOutcome
x0
            , bytes_requested :: Uint64
bytes_requested = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"bytes_requested" SDL_AsyncIOOutcome
x0
            , bytes_transferred :: Uint64
bytes_transferred = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"bytes_transferred" SDL_AsyncIOOutcome
x0
            }
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"userdata" SDL_AsyncIOOutcome
x0
      )

instance
  (ty ~ BG.Ptr BG.Void)
  => BG.HasField "userdata" (BG.Ptr SDL_AsyncIOOutcome) (BG.Ptr ty)
  where
  getField :: Ptr SDL_AsyncIOOutcome -> Ptr ty
getField = Proxy "userdata"
-> Ptr SDL_AsyncIOOutcome
-> Ptr (CFieldType SDL_AsyncIOOutcome "userdata")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"userdata")

instance HasCField.HasCField SDL_AsyncIOOutcome "userdata" where
  type
    CFieldType SDL_AsyncIOOutcome "userdata" =
      BG.Ptr BG.Void

  offset# :: Proxy# SDL_AsyncIOOutcome -> Proxy# "userdata" -> Int
offset# = \Proxy# SDL_AsyncIOOutcome
_ -> \Proxy# "userdata"
_ -> Int
48

-- | A queue of completed asynchronous I\/O tasks.
--
--     When starting an asynchronous operation, you specify a queue for the new task. A queue can be asked later if any tasks in it have completed, allowing an app to manage multiple pending tasks in one place, in whatever order they complete.
--
--     @since 3.2.0
--
--     [See also]: 'sDL_CreateAsyncIOQueue', 'sDL_ReadAsyncIO', 'sDL_WriteAsyncIO', 'sDL_GetAsyncIOResult', 'sDL_WaitAsyncIOResult'
--
--     [C declaration]: @struct SDL_AsyncIOQueue@, defined at @SDL3\/SDL_asyncio.h 183:16@
data SDL_AsyncIOQueue