sdl3_sys/generated/
iostream.rs

1//! SDL provides an abstract interface for reading and writing data streams. It
2//! offers implementations for files, memory, etc, and the app can provide
3//! their own implementations, too.
4//!
5//! [`SDL_IOStream`] is not related to the standard C++ iostream class, other than
6//! both are abstract interfaces to read/write data.
7
8use super::stdinc::*;
9
10use super::error::*;
11
12use super::properties::*;
13
14/// [`SDL_IOStream`] status, set by a read or write operation.
15///
16/// ## Availability
17/// This enum is available since SDL 3.2.0.
18///
19/// ## Known values (`sdl3-sys`)
20/// | Associated constant | Global constant | Description |
21/// | ------------------- | --------------- | ----------- |
22/// | [`READY`](SDL_IOStatus::READY) | [`SDL_IO_STATUS_READY`] | Everything is ready (no errors and not EOF). |
23/// | [`ERROR`](SDL_IOStatus::ERROR) | [`SDL_IO_STATUS_ERROR`] | Read or write I/O error |
24/// | [`EOF`](SDL_IOStatus::EOF) | [`SDL_IO_STATUS_EOF`] | End of file |
25/// | [`NOT_READY`](SDL_IOStatus::NOT_READY) | [`SDL_IO_STATUS_NOT_READY`] | Non blocking I/O, not ready |
26/// | [`READONLY`](SDL_IOStatus::READONLY) | [`SDL_IO_STATUS_READONLY`] | Tried to write a read-only buffer |
27/// | [`WRITEONLY`](SDL_IOStatus::WRITEONLY) | [`SDL_IO_STATUS_WRITEONLY`] | Tried to read a write-only buffer |
28#[repr(transparent)]
29#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
30pub struct SDL_IOStatus(pub ::core::ffi::c_int);
31
32impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_IOStatus {
33    #[inline(always)]
34    fn eq(&self, other: &::core::ffi::c_int) -> bool {
35        &self.0 == other
36    }
37}
38
39impl ::core::cmp::PartialEq<SDL_IOStatus> for ::core::ffi::c_int {
40    #[inline(always)]
41    fn eq(&self, other: &SDL_IOStatus) -> bool {
42        self == &other.0
43    }
44}
45
46impl From<SDL_IOStatus> for ::core::ffi::c_int {
47    #[inline(always)]
48    fn from(value: SDL_IOStatus) -> Self {
49        value.0
50    }
51}
52
53#[cfg(feature = "debug-impls")]
54impl ::core::fmt::Debug for SDL_IOStatus {
55    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
56        #[allow(unreachable_patterns)]
57        f.write_str(match *self {
58            Self::READY => "SDL_IO_STATUS_READY",
59            Self::ERROR => "SDL_IO_STATUS_ERROR",
60            Self::EOF => "SDL_IO_STATUS_EOF",
61            Self::NOT_READY => "SDL_IO_STATUS_NOT_READY",
62            Self::READONLY => "SDL_IO_STATUS_READONLY",
63            Self::WRITEONLY => "SDL_IO_STATUS_WRITEONLY",
64
65            _ => return write!(f, "SDL_IOStatus({})", self.0),
66        })
67    }
68}
69
70impl SDL_IOStatus {
71    /// Everything is ready (no errors and not EOF).
72    pub const READY: Self = Self((0 as ::core::ffi::c_int));
73    /// Read or write I/O error
74    pub const ERROR: Self = Self((1 as ::core::ffi::c_int));
75    /// End of file
76    pub const EOF: Self = Self((2 as ::core::ffi::c_int));
77    /// Non blocking I/O, not ready
78    pub const NOT_READY: Self = Self((3 as ::core::ffi::c_int));
79    /// Tried to write a read-only buffer
80    pub const READONLY: Self = Self((4 as ::core::ffi::c_int));
81    /// Tried to read a write-only buffer
82    pub const WRITEONLY: Self = Self((5 as ::core::ffi::c_int));
83}
84
85/// Everything is ready (no errors and not EOF).
86pub const SDL_IO_STATUS_READY: SDL_IOStatus = SDL_IOStatus::READY;
87/// Read or write I/O error
88pub const SDL_IO_STATUS_ERROR: SDL_IOStatus = SDL_IOStatus::ERROR;
89/// End of file
90pub const SDL_IO_STATUS_EOF: SDL_IOStatus = SDL_IOStatus::EOF;
91/// Non blocking I/O, not ready
92pub const SDL_IO_STATUS_NOT_READY: SDL_IOStatus = SDL_IOStatus::NOT_READY;
93/// Tried to write a read-only buffer
94pub const SDL_IO_STATUS_READONLY: SDL_IOStatus = SDL_IOStatus::READONLY;
95/// Tried to read a write-only buffer
96pub const SDL_IO_STATUS_WRITEONLY: SDL_IOStatus = SDL_IOStatus::WRITEONLY;
97
98#[cfg(feature = "metadata")]
99impl sdl3_sys::metadata::GroupMetadata for SDL_IOStatus {
100    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
101        &crate::metadata::iostream::METADATA_SDL_IOStatus;
102}
103
104/// Possible `whence` values for [`SDL_IOStream`] seeking.
105///
106/// These map to the same "whence" concept that `fseek` or `lseek` use in the
107/// standard C runtime.
108///
109/// ## Availability
110/// This enum is available since SDL 3.2.0.
111///
112/// ## Known values (`sdl3-sys`)
113/// | Associated constant | Global constant | Description |
114/// | ------------------- | --------------- | ----------- |
115/// | [`SET`](SDL_IOWhence::SET) | [`SDL_IO_SEEK_SET`] | Seek from the beginning of data |
116/// | [`CUR`](SDL_IOWhence::CUR) | [`SDL_IO_SEEK_CUR`] | Seek relative to current read point |
117/// | [`END`](SDL_IOWhence::END) | [`SDL_IO_SEEK_END`] | Seek relative to the end of data |
118#[repr(transparent)]
119#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
120pub struct SDL_IOWhence(pub ::core::ffi::c_int);
121
122impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_IOWhence {
123    #[inline(always)]
124    fn eq(&self, other: &::core::ffi::c_int) -> bool {
125        &self.0 == other
126    }
127}
128
129impl ::core::cmp::PartialEq<SDL_IOWhence> for ::core::ffi::c_int {
130    #[inline(always)]
131    fn eq(&self, other: &SDL_IOWhence) -> bool {
132        self == &other.0
133    }
134}
135
136impl From<SDL_IOWhence> for ::core::ffi::c_int {
137    #[inline(always)]
138    fn from(value: SDL_IOWhence) -> Self {
139        value.0
140    }
141}
142
143#[cfg(feature = "debug-impls")]
144impl ::core::fmt::Debug for SDL_IOWhence {
145    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
146        #[allow(unreachable_patterns)]
147        f.write_str(match *self {
148            Self::SET => "SDL_IO_SEEK_SET",
149            Self::CUR => "SDL_IO_SEEK_CUR",
150            Self::END => "SDL_IO_SEEK_END",
151
152            _ => return write!(f, "SDL_IOWhence({})", self.0),
153        })
154    }
155}
156
157impl SDL_IOWhence {
158    /// Seek from the beginning of data
159    pub const SET: Self = Self((0 as ::core::ffi::c_int));
160    /// Seek relative to current read point
161    pub const CUR: Self = Self((1 as ::core::ffi::c_int));
162    /// Seek relative to the end of data
163    pub const END: Self = Self((2 as ::core::ffi::c_int));
164}
165
166/// Seek from the beginning of data
167pub const SDL_IO_SEEK_SET: SDL_IOWhence = SDL_IOWhence::SET;
168/// Seek relative to current read point
169pub const SDL_IO_SEEK_CUR: SDL_IOWhence = SDL_IOWhence::CUR;
170/// Seek relative to the end of data
171pub const SDL_IO_SEEK_END: SDL_IOWhence = SDL_IOWhence::END;
172
173#[cfg(feature = "metadata")]
174impl sdl3_sys::metadata::GroupMetadata for SDL_IOWhence {
175    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
176        &crate::metadata::iostream::METADATA_SDL_IOWhence;
177}
178
179/// The function pointers that drive an [`SDL_IOStream`].
180///
181/// Applications can provide this struct to [`SDL_OpenIO()`] to create their own
182/// implementation of [`SDL_IOStream`]. This is not necessarily required, as SDL
183/// already offers several common types of I/O streams, via functions like
184/// [`SDL_IOFromFile()`] and [`SDL_IOFromMem()`].
185///
186/// This structure should be initialized using [`SDL_INIT_INTERFACE()`]
187///
188/// ## Availability
189/// This struct is available since SDL 3.2.0.
190///
191/// ## See also
192/// - [`SDL_INIT_INTERFACE`]
193///
194/// ## Notes for `sdl3-sys`
195/// This interface struct can be initialized with [`SDL_IOStreamInterface::new()`] or `Default::default()`.
196#[repr(C)]
197#[cfg_attr(feature = "debug-impls", derive(Debug))]
198pub struct SDL_IOStreamInterface {
199    pub version: Uint32,
200    /// Return the number of bytes in this [`SDL_IOStream`]
201    ///
202    /// \return the total size of the data stream, or -1 on error.
203    pub size:
204        ::core::option::Option<unsafe extern "C" fn(userdata: *mut ::core::ffi::c_void) -> Sint64>,
205    /// Seek to `offset` relative to `whence`, one of stdio's whence values:
206    /// [`SDL_IO_SEEK_SET`], [`SDL_IO_SEEK_CUR`], [`SDL_IO_SEEK_END`]
207    ///
208    /// \return the final offset in the data stream, or -1 on error.
209    pub seek: ::core::option::Option<
210        unsafe extern "C" fn(
211            userdata: *mut ::core::ffi::c_void,
212            offset: Sint64,
213            whence: SDL_IOWhence,
214        ) -> Sint64,
215    >,
216    /// Read up to `size` bytes from the data stream to the area pointed
217    /// at by `ptr`. `size` will always be > 0.
218    ///
219    /// On an incomplete read, you should set `*status` to a value from the
220    /// [`SDL_IOStatus`] enum. You do not have to explicitly set this on
221    /// a complete, successful read.
222    ///
223    /// \return the number of bytes read
224    pub read: ::core::option::Option<
225        unsafe extern "C" fn(
226            userdata: *mut ::core::ffi::c_void,
227            ptr: *mut ::core::ffi::c_void,
228            size: ::core::primitive::usize,
229            status: *mut SDL_IOStatus,
230        ) -> ::core::primitive::usize,
231    >,
232    /// Write exactly `size` bytes from the area pointed at by `ptr`
233    /// to data stream. `size` will always be > 0.
234    ///
235    /// On an incomplete write, you should set `*status` to a value from the
236    /// [`SDL_IOStatus`] enum. You do not have to explicitly set this on
237    /// a complete, successful write.
238    ///
239    /// \return the number of bytes written
240    pub write: ::core::option::Option<
241        unsafe extern "C" fn(
242            userdata: *mut ::core::ffi::c_void,
243            ptr: *const ::core::ffi::c_void,
244            size: ::core::primitive::usize,
245            status: *mut SDL_IOStatus,
246        ) -> ::core::primitive::usize,
247    >,
248    /// If the stream is buffering, make sure the data is written out.
249    ///
250    /// On failure, you should set `*status` to a value from the
251    /// [`SDL_IOStatus`] enum. You do not have to explicitly set this on
252    /// a successful flush.
253    ///
254    /// \return true if successful or false on write error when flushing data.
255    pub flush: ::core::option::Option<
256        unsafe extern "C" fn(
257            userdata: *mut ::core::ffi::c_void,
258            status: *mut SDL_IOStatus,
259        ) -> ::core::primitive::bool,
260    >,
261    /// Close and free any allocated resources.
262    ///
263    /// This does not guarantee file writes will sync to physical media; they
264    /// can be in the system's file cache, waiting to go to disk.
265    ///
266    /// The [`SDL_IOStream`] is still destroyed even if this fails, so clean up anything
267    /// even if flushing buffers, etc, returns an error.
268    ///
269    /// \return true if successful or false on write error when flushing data.
270    pub close: ::core::option::Option<
271        unsafe extern "C" fn(userdata: *mut ::core::ffi::c_void) -> ::core::primitive::bool,
272    >,
273}
274
275impl SDL_IOStreamInterface {
276    /// Create a new `SDL_IOStreamInterface` initialized with `SDL_INIT_INTERFACE`
277    #[inline]
278    pub const fn new() -> Self {
279        const { ::core::assert!(::core::mem::size_of::<Self>() <= ::core::primitive::u32::MAX as usize) };
280        let mut this = unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() };
281        this.version = ::core::mem::size_of::<Self>() as ::core::primitive::u32;
282        this
283    }
284}
285
286impl ::core::default::Default for SDL_IOStreamInterface {
287    /// Create a new `SDL_IOStreamInterface` initialized with `SDL_INIT_INTERFACE`
288    #[inline(always)]
289    fn default() -> Self {
290        Self::new()
291    }
292}
293
294const _: () = ::core::assert!(
295    (((::core::mem::size_of::<*mut ::core::ffi::c_void>() == 4_usize)
296        && (::core::mem::size_of::<SDL_IOStreamInterface>() == 28_usize))
297        || ((::core::mem::size_of::<*mut ::core::ffi::c_void>() == 8_usize)
298            && (::core::mem::size_of::<SDL_IOStreamInterface>() == 56_usize)))
299);
300
301unsafe extern "C" {
302    /// Use this function to create a new [`SDL_IOStream`] structure for reading from
303    /// and/or writing to a named file.
304    ///
305    /// The `mode` string is treated roughly the same as in a call to the C
306    /// library's fopen(), even if SDL doesn't happen to use fopen() behind the
307    /// scenes.
308    ///
309    /// Available `mode` strings:
310    ///
311    /// - "r": Open a file for reading. The file must exist.
312    /// - "w": Create an empty file for writing. If a file with the same name
313    ///   already exists its content is erased and the file is treated as a new
314    ///   empty file.
315    /// - "wx": Create an empty file for writing. If a file with the same name
316    ///   already exists, the call fails.
317    /// - "a": Append to a file. Writing operations append data at the end of the
318    ///   file. The file is created if it does not exist.
319    /// - "r+": Open a file for update both reading and writing. The file must
320    ///   exist.
321    /// - "w+": Create an empty file for both reading and writing. If a file with
322    ///   the same name already exists its content is erased and the file is
323    ///   treated as a new empty file.
324    /// - "w+x": Create an empty file for both reading and writing. If a file with
325    ///   the same name already exists, the call fails.
326    /// - "a+": Open a file for reading and appending. All writing operations are
327    ///   performed at the end of the file, protecting the previous content to be
328    ///   overwritten. You can reposition (fseek, rewind) the internal pointer to
329    ///   anywhere in the file for reading, but writing operations will move it
330    ///   back to the end of file. The file is created if it does not exist.
331    ///
332    /// **NOTE**: In order to open a file as a binary file, a "b" character has to
333    /// be included in the `mode` string. This additional "b" character can either
334    /// be appended at the end of the string (thus making the following compound
335    /// modes: "rb", "wb", "ab", "r+b", "w+b", "a+b") or be inserted between the
336    /// letter and the "+" sign for the mixed modes ("rb+", "wb+", "ab+").
337    /// Additional characters may follow the sequence, although they should have no
338    /// effect. For example, "t" is sometimes appended to make explicit the file is
339    /// a text file.
340    ///
341    /// This function supports Unicode filenames, but they must be encoded in UTF-8
342    /// format, regardless of the underlying operating system.
343    ///
344    /// In Android, [`SDL_IOFromFile()`] can be used to open content:// URIs. As a
345    /// fallback, [`SDL_IOFromFile()`] will transparently open a matching filename in
346    /// the app's `assets`.
347    ///
348    /// Closing the [`SDL_IOStream`] will close SDL's internal file handle.
349    ///
350    /// The following properties may be set at creation time by SDL:
351    ///
352    /// - [`SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER`]\: a pointer, that can be cast
353    ///   to a win32 `HANDLE`, that this [`SDL_IOStream`] is using to access the
354    ///   filesystem. If the program isn't running on Windows, or SDL used some
355    ///   other method to access the filesystem, this property will not be set.
356    /// - [`SDL_PROP_IOSTREAM_STDIO_FILE_POINTER`]\: a pointer, that can be cast to a
357    ///   stdio `FILE *`, that this [`SDL_IOStream`] is using to access the filesystem.
358    ///   If SDL used some other method to access the filesystem, this property
359    ///   will not be set. PLEASE NOTE that if SDL is using a different C runtime
360    ///   than your app, trying to use this pointer will almost certainly result in
361    ///   a crash! This is mostly a problem on Windows; make sure you build SDL and
362    ///   your app with the same compiler and settings to avoid it.
363    /// - [`SDL_PROP_IOSTREAM_FILE_DESCRIPTOR_NUMBER`]\: a file descriptor that this
364    ///   [`SDL_IOStream`] is using to access the filesystem.
365    /// - [`SDL_PROP_IOSTREAM_ANDROID_AASSET_POINTER`]\: a pointer, that can be cast
366    ///   to an Android NDK `AAsset *`, that this [`SDL_IOStream`] is using to access
367    ///   the filesystem. If SDL used some other method to access the filesystem,
368    ///   this property will not be set.
369    ///
370    /// ## Parameters
371    /// - `file`: a UTF-8 string representing the filename to open.
372    /// - `mode`: an ASCII string representing the mode to be used for opening
373    ///   the file.
374    ///
375    /// ## Return value
376    /// Returns a pointer to the [`SDL_IOStream`] structure that is created or NULL on
377    ///   failure; call [`SDL_GetError()`] for more information.
378    ///
379    /// ## Thread safety
380    /// It is safe to call this function from any thread.
381    ///
382    /// ## Availability
383    /// This function is available since SDL 3.2.0.
384    ///
385    /// ## See also
386    /// - [`SDL_CloseIO`]
387    /// - [`SDL_FlushIO`]
388    /// - [`SDL_ReadIO`]
389    /// - [`SDL_SeekIO`]
390    /// - [`SDL_TellIO`]
391    /// - [`SDL_WriteIO`]
392    pub fn SDL_IOFromFile(
393        file: *const ::core::ffi::c_char,
394        mode: *const ::core::ffi::c_char,
395    ) -> *mut SDL_IOStream;
396}
397
398pub const SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER: *const ::core::ffi::c_char =
399    c"SDL.iostream.windows.handle".as_ptr();
400
401pub const SDL_PROP_IOSTREAM_STDIO_FILE_POINTER: *const ::core::ffi::c_char =
402    c"SDL.iostream.stdio.file".as_ptr();
403
404pub const SDL_PROP_IOSTREAM_FILE_DESCRIPTOR_NUMBER: *const ::core::ffi::c_char =
405    c"SDL.iostream.file_descriptor".as_ptr();
406
407pub const SDL_PROP_IOSTREAM_ANDROID_AASSET_POINTER: *const ::core::ffi::c_char =
408    c"SDL.iostream.android.aasset".as_ptr();
409
410unsafe extern "C" {
411    /// Use this function to prepare a read-write memory buffer for use with
412    /// [`SDL_IOStream`].
413    ///
414    /// This function sets up an [`SDL_IOStream`] struct based on a memory area of a
415    /// certain size, for both read and write access.
416    ///
417    /// This memory buffer is not copied by the [`SDL_IOStream`]; the pointer you
418    /// provide must remain valid until you close the stream.
419    ///
420    /// If you need to make sure the [`SDL_IOStream`] never writes to the memory
421    /// buffer, you should use [`SDL_IOFromConstMem()`] with a read-only buffer of
422    /// memory instead.
423    ///
424    /// The following properties will be set at creation time by SDL:
425    ///
426    /// - [`SDL_PROP_IOSTREAM_MEMORY_POINTER`]\: this will be the `mem` parameter that
427    ///   was passed to this function.
428    /// - [`SDL_PROP_IOSTREAM_MEMORY_SIZE_NUMBER`]\: this will be the `size` parameter
429    ///   that was passed to this function.
430    ///
431    /// Additionally, the following properties are recognized:
432    ///
433    /// - [`SDL_PROP_IOSTREAM_MEMORY_FREE_FUNC_POINTER`]\: if this property is set to
434    ///   a non-NULL value it will be interpreted as a function of [`SDL_free_func`]
435    ///   type and called with the passed `mem` pointer when closing the stream. By
436    ///   default it is unset, i.e., the memory will not be freed.
437    ///
438    /// ## Parameters
439    /// - `mem`: a pointer to a buffer to feed an [`SDL_IOStream`] stream.
440    /// - `size`: the buffer size, in bytes.
441    ///
442    /// ## Return value
443    /// Returns a pointer to a new [`SDL_IOStream`] structure or NULL on failure; call
444    ///   [`SDL_GetError()`] for more information.
445    ///
446    /// ## Thread safety
447    /// It is safe to call this function from any thread.
448    ///
449    /// ## Availability
450    /// This function is available since SDL 3.2.0.
451    ///
452    /// ## See also
453    /// - [`SDL_IOFromConstMem`]
454    /// - [`SDL_CloseIO`]
455    /// - [`SDL_FlushIO`]
456    /// - [`SDL_ReadIO`]
457    /// - [`SDL_SeekIO`]
458    /// - [`SDL_TellIO`]
459    /// - [`SDL_WriteIO`]
460    pub fn SDL_IOFromMem(
461        mem: *mut ::core::ffi::c_void,
462        size: ::core::primitive::usize,
463    ) -> *mut SDL_IOStream;
464}
465
466pub const SDL_PROP_IOSTREAM_MEMORY_POINTER: *const ::core::ffi::c_char =
467    c"SDL.iostream.memory.base".as_ptr();
468
469pub const SDL_PROP_IOSTREAM_MEMORY_SIZE_NUMBER: *const ::core::ffi::c_char =
470    c"SDL.iostream.memory.size".as_ptr();
471
472pub const SDL_PROP_IOSTREAM_MEMORY_FREE_FUNC_POINTER: *const ::core::ffi::c_char =
473    c"SDL.iostream.memory.free".as_ptr();
474
475unsafe extern "C" {
476    /// Use this function to prepare a read-only memory buffer for use with
477    /// [`SDL_IOStream`].
478    ///
479    /// This function sets up an [`SDL_IOStream`] struct based on a memory area of a
480    /// certain size. It assumes the memory area is not writable.
481    ///
482    /// Attempting to write to this [`SDL_IOStream`] stream will report an error
483    /// without writing to the memory buffer.
484    ///
485    /// This memory buffer is not copied by the [`SDL_IOStream`]; the pointer you
486    /// provide must remain valid until you close the stream.
487    ///
488    /// If you need to write to a memory buffer, you should use [`SDL_IOFromMem()`]
489    /// with a writable buffer of memory instead.
490    ///
491    /// The following properties will be set at creation time by SDL:
492    ///
493    /// - [`SDL_PROP_IOSTREAM_MEMORY_POINTER`]\: this will be the `mem` parameter that
494    ///   was passed to this function.
495    /// - [`SDL_PROP_IOSTREAM_MEMORY_SIZE_NUMBER`]\: this will be the `size` parameter
496    ///   that was passed to this function.
497    ///
498    /// Additionally, the following properties are recognized:
499    ///
500    /// - [`SDL_PROP_IOSTREAM_MEMORY_FREE_FUNC_POINTER`]\: if this property is set to
501    ///   a non-NULL value it will be interpreted as a function of [`SDL_free_func`]
502    ///   type and called with the passed `mem` pointer when closing the stream. By
503    ///   default it is unset, i.e., the memory will not be freed.
504    ///
505    /// ## Parameters
506    /// - `mem`: a pointer to a read-only buffer to feed an [`SDL_IOStream`] stream.
507    /// - `size`: the buffer size, in bytes.
508    ///
509    /// ## Return value
510    /// Returns a pointer to a new [`SDL_IOStream`] structure or NULL on failure; call
511    ///   [`SDL_GetError()`] for more information.
512    ///
513    /// ## Thread safety
514    /// It is safe to call this function from any thread.
515    ///
516    /// ## Availability
517    /// This function is available since SDL 3.2.0.
518    ///
519    /// ## See also
520    /// - [`SDL_IOFromMem`]
521    /// - [`SDL_CloseIO`]
522    /// - [`SDL_ReadIO`]
523    /// - [`SDL_SeekIO`]
524    /// - [`SDL_TellIO`]
525    pub fn SDL_IOFromConstMem(
526        mem: *const ::core::ffi::c_void,
527        size: ::core::primitive::usize,
528    ) -> *mut SDL_IOStream;
529}
530
531unsafe extern "C" {
532    /// Use this function to create an [`SDL_IOStream`] that is backed by dynamically
533    /// allocated memory.
534    ///
535    /// This supports the following properties to provide access to the memory and
536    /// control over allocations:
537    ///
538    /// - [`SDL_PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER`]\: a pointer to the internal
539    ///   memory of the stream. This can be set to NULL to transfer ownership of
540    ///   the memory to the application, which should free the memory with
541    ///   [`SDL_free()`]. If this is done, the next operation on the stream must be
542    ///   [`SDL_CloseIO()`].
543    /// - [`SDL_PROP_IOSTREAM_DYNAMIC_CHUNKSIZE_NUMBER`]\: memory will be allocated in
544    ///   multiples of this size, defaulting to 1024.
545    ///
546    /// ## Return value
547    /// Returns a pointer to a new [`SDL_IOStream`] structure or NULL on failure; call
548    ///   [`SDL_GetError()`] for more information.
549    ///
550    /// ## Thread safety
551    /// It is safe to call this function from any thread.
552    ///
553    /// ## Availability
554    /// This function is available since SDL 3.2.0.
555    ///
556    /// ## See also
557    /// - [`SDL_CloseIO`]
558    /// - [`SDL_ReadIO`]
559    /// - [`SDL_SeekIO`]
560    /// - [`SDL_TellIO`]
561    /// - [`SDL_WriteIO`]
562    pub fn SDL_IOFromDynamicMem() -> *mut SDL_IOStream;
563}
564
565pub const SDL_PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER: *const ::core::ffi::c_char =
566    c"SDL.iostream.dynamic.memory".as_ptr();
567
568pub const SDL_PROP_IOSTREAM_DYNAMIC_CHUNKSIZE_NUMBER: *const ::core::ffi::c_char =
569    c"SDL.iostream.dynamic.chunksize".as_ptr();
570
571unsafe extern "C" {
572    /// Create a custom [`SDL_IOStream`].
573    ///
574    /// Applications do not need to use this function unless they are providing
575    /// their own [`SDL_IOStream`] implementation. If you just need an [`SDL_IOStream`] to
576    /// read/write a common data source, you should use the built-in
577    /// implementations in SDL, like [`SDL_IOFromFile()`] or [`SDL_IOFromMem()`], etc.
578    ///
579    /// This function makes a copy of `iface` and the caller does not need to keep
580    /// it around after this call.
581    ///
582    /// ## Parameters
583    /// - `iface`: the interface that implements this [`SDL_IOStream`], initialized
584    ///   using [`SDL_INIT_INTERFACE()`].
585    /// - `userdata`: the pointer that will be passed to the interface functions.
586    ///
587    /// ## Return value
588    /// Returns a pointer to the allocated memory on success or NULL on failure;
589    ///   call [`SDL_GetError()`] for more information.
590    ///
591    /// ## Thread safety
592    /// It is safe to call this function from any thread.
593    ///
594    /// ## Availability
595    /// This function is available since SDL 3.2.0.
596    ///
597    /// ## See also
598    /// - [`SDL_CloseIO`]
599    /// - [`SDL_INIT_INTERFACE`]
600    /// - [`SDL_IOFromConstMem`]
601    /// - [`SDL_IOFromFile`]
602    /// - [`SDL_IOFromMem`]
603    pub fn SDL_OpenIO(
604        iface: *const SDL_IOStreamInterface,
605        userdata: *mut ::core::ffi::c_void,
606    ) -> *mut SDL_IOStream;
607}
608
609unsafe extern "C" {
610    /// Close and free an allocated [`SDL_IOStream`] structure.
611    ///
612    /// [`SDL_CloseIO()`] closes and cleans up the [`SDL_IOStream`] stream. It releases any
613    /// resources used by the stream and frees the [`SDL_IOStream`] itself. This
614    /// returns true on success, or false if the stream failed to flush to its
615    /// output (e.g. to disk).
616    ///
617    /// Note that if this fails to flush the stream for any reason, this function
618    /// reports an error, but the [`SDL_IOStream`] is still invalid once this function
619    /// returns.
620    ///
621    /// This call flushes any buffered writes to the operating system, but there
622    /// are no guarantees that those writes have gone to physical media; they might
623    /// be in the OS's file cache, waiting to go to disk later. If it's absolutely
624    /// crucial that writes go to disk immediately, so they are definitely stored
625    /// even if the power fails before the file cache would have caught up, one
626    /// should call [`SDL_FlushIO()`] before closing. Note that flushing takes time and
627    /// makes the system and your app operate less efficiently, so do so sparingly.
628    ///
629    /// ## Parameters
630    /// - `context`: [`SDL_IOStream`] structure to close.
631    ///
632    /// ## Return value
633    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
634    ///   information.
635    ///
636    /// ## Thread safety
637    /// Do not use the same [`SDL_IOStream`] from two threads at once.
638    ///
639    /// ## Availability
640    /// This function is available since SDL 3.2.0.
641    ///
642    /// ## See also
643    /// - [`SDL_OpenIO`]
644    pub fn SDL_CloseIO(context: *mut SDL_IOStream) -> ::core::primitive::bool;
645}
646
647unsafe extern "C" {
648    /// Get the properties associated with an [`SDL_IOStream`].
649    ///
650    /// ## Parameters
651    /// - `context`: a pointer to an [`SDL_IOStream`] structure.
652    ///
653    /// ## Return value
654    /// Returns a valid property ID on success or 0 on failure; call
655    ///   [`SDL_GetError()`] for more information.
656    ///
657    /// ## Thread safety
658    /// Do not use the same [`SDL_IOStream`] from two threads at once.
659    ///
660    /// ## Availability
661    /// This function is available since SDL 3.2.0.
662    pub fn SDL_GetIOProperties(context: *mut SDL_IOStream) -> SDL_PropertiesID;
663}
664
665unsafe extern "C" {
666    /// Query the stream status of an [`SDL_IOStream`].
667    ///
668    /// This information can be useful to decide if a short read or write was due
669    /// to an error, an EOF, or a non-blocking operation that isn't yet ready to
670    /// complete.
671    ///
672    /// An SDL_IOStream's status is only expected to change after a [`SDL_ReadIO`] or
673    /// [`SDL_WriteIO`] call; don't expect it to change if you just call this query
674    /// function in a tight loop.
675    ///
676    /// ## Parameters
677    /// - `context`: the [`SDL_IOStream`] to query.
678    ///
679    /// ## Return value
680    /// Returns an [`SDL_IOStatus`] enum with the current state.
681    ///
682    /// ## Thread safety
683    /// Do not use the same [`SDL_IOStream`] from two threads at once.
684    ///
685    /// ## Availability
686    /// This function is available since SDL 3.2.0.
687    pub fn SDL_GetIOStatus(context: *mut SDL_IOStream) -> SDL_IOStatus;
688}
689
690unsafe extern "C" {
691    /// Use this function to get the size of the data stream in an [`SDL_IOStream`].
692    ///
693    /// ## Parameters
694    /// - `context`: the [`SDL_IOStream`] to get the size of the data stream from.
695    ///
696    /// ## Return value
697    /// Returns the size of the data stream in the [`SDL_IOStream`] on success or a
698    ///   negative error code on failure; call [`SDL_GetError()`] for more
699    ///   information.
700    ///
701    /// ## Thread safety
702    /// Do not use the same [`SDL_IOStream`] from two threads at once.
703    ///
704    /// ## Availability
705    /// This function is available since SDL 3.2.0.
706    pub fn SDL_GetIOSize(context: *mut SDL_IOStream) -> Sint64;
707}
708
709unsafe extern "C" {
710    /// Seek within an [`SDL_IOStream`] data stream.
711    ///
712    /// This function seeks to byte `offset`, relative to `whence`.
713    ///
714    /// `whence` may be any of the following values:
715    ///
716    /// - [`SDL_IO_SEEK_SET`]\: seek from the beginning of data
717    /// - [`SDL_IO_SEEK_CUR`]\: seek relative to current read point
718    /// - [`SDL_IO_SEEK_END`]\: seek relative to the end of data
719    ///
720    /// If this stream can not seek, it will return -1.
721    ///
722    /// ## Parameters
723    /// - `context`: a pointer to an [`SDL_IOStream`] structure.
724    /// - `offset`: an offset in bytes, relative to `whence` location; can be
725    ///   negative.
726    /// - `whence`: any of [`SDL_IO_SEEK_SET`], [`SDL_IO_SEEK_CUR`],
727    ///   [`SDL_IO_SEEK_END`].
728    ///
729    /// ## Return value
730    /// Returns the final offset in the data stream after the seek or -1 on
731    ///   failure; call [`SDL_GetError()`] for more information.
732    ///
733    /// ## Thread safety
734    /// Do not use the same [`SDL_IOStream`] from two threads at once.
735    ///
736    /// ## Availability
737    /// This function is available since SDL 3.2.0.
738    ///
739    /// ## See also
740    /// - [`SDL_TellIO`]
741    pub fn SDL_SeekIO(context: *mut SDL_IOStream, offset: Sint64, whence: SDL_IOWhence) -> Sint64;
742}
743
744unsafe extern "C" {
745    /// Determine the current read/write offset in an [`SDL_IOStream`] data stream.
746    ///
747    /// [`SDL_TellIO`] is actually a wrapper function that calls the SDL_IOStream's
748    /// `seek` method, with an offset of 0 bytes from [`SDL_IO_SEEK_CUR`], to
749    /// simplify application development.
750    ///
751    /// ## Parameters
752    /// - `context`: an [`SDL_IOStream`] data stream object from which to get the
753    ///   current offset.
754    ///
755    /// ## Return value
756    /// Returns the current offset in the stream, or -1 if the information can not
757    ///   be determined.
758    ///
759    /// ## Thread safety
760    /// Do not use the same [`SDL_IOStream`] from two threads at once.
761    ///
762    /// ## Availability
763    /// This function is available since SDL 3.2.0.
764    ///
765    /// ## See also
766    /// - [`SDL_SeekIO`]
767    pub fn SDL_TellIO(context: *mut SDL_IOStream) -> Sint64;
768}
769
770unsafe extern "C" {
771    /// Read from a data source.
772    ///
773    /// This function reads up `size` bytes from the data source to the area
774    /// pointed at by `ptr`. This function may read less bytes than requested.
775    ///
776    /// This function will return zero when the data stream is completely read, and
777    /// [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If zero is returned and
778    /// the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different error
779    /// value and [`SDL_GetError()`] will offer a human-readable message.
780    ///
781    /// A request for zero bytes on a valid stream will return zero immediately
782    /// without accessing the stream, so the stream status (EOF, err, etc) will not
783    /// change.
784    ///
785    /// ## Parameters
786    /// - `context`: a pointer to an [`SDL_IOStream`] structure.
787    /// - `ptr`: a pointer to a buffer to read data into.
788    /// - `size`: the number of bytes to read from the data source.
789    ///
790    /// ## Return value
791    /// Returns the number of bytes read, or 0 on end of file or other failure;
792    ///   call [`SDL_GetError()`] for more information.
793    ///
794    /// ## Thread safety
795    /// Do not use the same [`SDL_IOStream`] from two threads at once.
796    ///
797    /// ## Availability
798    /// This function is available since SDL 3.2.0.
799    ///
800    /// ## See also
801    /// - [`SDL_WriteIO`]
802    /// - [`SDL_GetIOStatus`]
803    pub fn SDL_ReadIO(
804        context: *mut SDL_IOStream,
805        ptr: *mut ::core::ffi::c_void,
806        size: ::core::primitive::usize,
807    ) -> ::core::primitive::usize;
808}
809
810unsafe extern "C" {
811    /// Write to an [`SDL_IOStream`] data stream.
812    ///
813    /// This function writes exactly `size` bytes from the area pointed at by `ptr`
814    /// to the stream. If this fails for any reason, it'll return less than `size`
815    /// to demonstrate how far the write progressed. On success, it returns `size`.
816    ///
817    /// On error, this function still attempts to write as much as possible, so it
818    /// might return a positive value less than the requested write size.
819    ///
820    /// The caller can use [`SDL_GetIOStatus()`] to determine if the problem is
821    /// recoverable, such as a non-blocking write that can simply be retried later,
822    /// or a fatal error.
823    ///
824    /// A request for zero bytes on a valid stream will return zero immediately
825    /// without accessing the stream, so the stream status (EOF, err, etc) will not
826    /// change.
827    ///
828    /// ## Parameters
829    /// - `context`: a pointer to an [`SDL_IOStream`] structure.
830    /// - `ptr`: a pointer to a buffer containing data to write.
831    /// - `size`: the number of bytes to write.
832    ///
833    /// ## Return value
834    /// Returns the number of bytes written, which will be less than `size` on
835    ///   failure; call [`SDL_GetError()`] for more information.
836    ///
837    /// ## Thread safety
838    /// Do not use the same [`SDL_IOStream`] from two threads at once.
839    ///
840    /// ## Availability
841    /// This function is available since SDL 3.2.0.
842    ///
843    /// ## See also
844    /// - [`SDL_IOprintf`]
845    /// - [`SDL_ReadIO`]
846    /// - [`SDL_SeekIO`]
847    /// - [`SDL_FlushIO`]
848    /// - [`SDL_GetIOStatus`]
849    pub fn SDL_WriteIO(
850        context: *mut SDL_IOStream,
851        ptr: *const ::core::ffi::c_void,
852        size: ::core::primitive::usize,
853    ) -> ::core::primitive::usize;
854}
855
856unsafe extern "C" {
857    /// Print to an [`SDL_IOStream`] data stream.
858    ///
859    /// This function does formatted printing to the stream.
860    ///
861    /// ## Parameters
862    /// - `context`: a pointer to an [`SDL_IOStream`] structure.
863    /// - `fmt`: a printf() style format string.
864    /// - `...`: additional parameters matching % tokens in the `fmt` string, if
865    ///   any.
866    ///
867    /// ## Return value
868    /// Returns the number of bytes written or 0 on failure; call [`SDL_GetError()`]
869    ///   for more information.
870    ///
871    /// ## Thread safety
872    /// Do not use the same [`SDL_IOStream`] from two threads at once.
873    ///
874    /// ## Availability
875    /// This function is available since SDL 3.2.0.
876    ///
877    /// ## See also
878    /// - [`SDL_IOvprintf`]
879    /// - [`SDL_WriteIO`]
880    pub fn SDL_IOprintf(
881        context: *mut SDL_IOStream,
882        fmt: *const ::core::ffi::c_char,
883        ...
884    ) -> ::core::primitive::usize;
885}
886
887unsafe extern "C" {
888    /// Print to an [`SDL_IOStream`] data stream.
889    ///
890    /// This function does formatted printing to the stream.
891    ///
892    /// ## Parameters
893    /// - `context`: a pointer to an [`SDL_IOStream`] structure.
894    /// - `fmt`: a printf() style format string.
895    /// - `ap`: a variable argument list.
896    ///
897    /// ## Return value
898    /// Returns the number of bytes written or 0 on failure; call [`SDL_GetError()`]
899    ///   for more information.
900    ///
901    /// ## Thread safety
902    /// Do not use the same [`SDL_IOStream`] from two threads at once.
903    ///
904    /// ## Availability
905    /// This function is available since SDL 3.2.0.
906    ///
907    /// ## See also
908    /// - [`SDL_IOprintf`]
909    /// - [`SDL_WriteIO`]
910    pub fn SDL_IOvprintf(
911        context: *mut SDL_IOStream,
912        fmt: *const ::core::ffi::c_char,
913        ap: crate::ffi::VaList,
914    ) -> ::core::primitive::usize;
915}
916
917unsafe extern "C" {
918    /// Flush any buffered data in the stream.
919    ///
920    /// This function makes sure that any buffered data is written to the stream.
921    /// Normally this isn't necessary but if the stream is a pipe or socket it
922    /// guarantees that any pending data is sent.
923    ///
924    /// ## Parameters
925    /// - `context`: [`SDL_IOStream`] structure to flush.
926    ///
927    /// ## Return value
928    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
929    ///   information.
930    ///
931    /// ## Thread safety
932    /// Do not use the same [`SDL_IOStream`] from two threads at once.
933    ///
934    /// ## Availability
935    /// This function is available since SDL 3.2.0.
936    ///
937    /// ## See also
938    /// - [`SDL_OpenIO`]
939    /// - [`SDL_WriteIO`]
940    pub fn SDL_FlushIO(context: *mut SDL_IOStream) -> ::core::primitive::bool;
941}
942
943unsafe extern "C" {
944    /// Load all the data from an SDL data stream.
945    ///
946    /// The data is allocated with a zero byte at the end (null terminated) for
947    /// convenience. This extra byte is not included in the value reported via
948    /// `datasize`.
949    ///
950    /// The data should be freed with [`SDL_free()`].
951    ///
952    /// ## Parameters
953    /// - `src`: the [`SDL_IOStream`] to read all available data from.
954    /// - `datasize`: a pointer filled in with the number of bytes read, may be
955    ///   NULL.
956    /// - `closeio`: if true, calls [`SDL_CloseIO()`] on `src` before returning, even
957    ///   in the case of an error.
958    ///
959    /// ## Return value
960    /// Returns the data or NULL on failure; call [`SDL_GetError()`] for more
961    ///   information.
962    ///
963    /// ## Thread safety
964    /// Do not use the same [`SDL_IOStream`] from two threads at once.
965    ///
966    /// ## Availability
967    /// This function is available since SDL 3.2.0.
968    ///
969    /// ## See also
970    /// - [`SDL_LoadFile`]
971    /// - [`SDL_SaveFile_IO`]
972    pub fn SDL_LoadFile_IO(
973        src: *mut SDL_IOStream,
974        datasize: *mut ::core::primitive::usize,
975        closeio: ::core::primitive::bool,
976    ) -> *mut ::core::ffi::c_void;
977}
978
979unsafe extern "C" {
980    /// Load all the data from a file path.
981    ///
982    /// The data is allocated with a zero byte at the end (null terminated) for
983    /// convenience. This extra byte is not included in the value reported via
984    /// `datasize`.
985    ///
986    /// The data should be freed with [`SDL_free()`].
987    ///
988    /// ## Parameters
989    /// - `file`: the path to read all available data from.
990    /// - `datasize`: if not NULL, will store the number of bytes read.
991    ///
992    /// ## Return value
993    /// Returns the data or NULL on failure; call [`SDL_GetError()`] for more
994    ///   information.
995    ///
996    /// ## Thread safety
997    /// It is safe to call this function from any thread.
998    ///
999    /// ## Availability
1000    /// This function is available since SDL 3.2.0.
1001    ///
1002    /// ## See also
1003    /// - [`SDL_LoadFile_IO`]
1004    /// - [`SDL_SaveFile`]
1005    pub fn SDL_LoadFile(
1006        file: *const ::core::ffi::c_char,
1007        datasize: *mut ::core::primitive::usize,
1008    ) -> *mut ::core::ffi::c_void;
1009}
1010
1011unsafe extern "C" {
1012    /// Save all the data into an SDL data stream.
1013    ///
1014    /// ## Parameters
1015    /// - `src`: the [`SDL_IOStream`] to write all data to.
1016    /// - `data`: the data to be written. If datasize is 0, may be NULL or a
1017    ///   invalid pointer.
1018    /// - `datasize`: the number of bytes to be written.
1019    /// - `closeio`: if true, calls [`SDL_CloseIO()`] on `src` before returning, even
1020    ///   in the case of an error.
1021    ///
1022    /// ## Return value
1023    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
1024    ///   information.
1025    ///
1026    /// ## Thread safety
1027    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1028    ///
1029    /// ## Availability
1030    /// This function is available since SDL 3.2.0.
1031    ///
1032    /// ## See also
1033    /// - [`SDL_SaveFile`]
1034    /// - [`SDL_LoadFile_IO`]
1035    pub fn SDL_SaveFile_IO(
1036        src: *mut SDL_IOStream,
1037        data: *const ::core::ffi::c_void,
1038        datasize: ::core::primitive::usize,
1039        closeio: ::core::primitive::bool,
1040    ) -> ::core::primitive::bool;
1041}
1042
1043unsafe extern "C" {
1044    /// Save all the data into a file path.
1045    ///
1046    /// ## Parameters
1047    /// - `file`: the path to write all available data into.
1048    /// - `data`: the data to be written. If datasize is 0, may be NULL or a
1049    ///   invalid pointer.
1050    /// - `datasize`: the number of bytes to be written.
1051    ///
1052    /// ## Return value
1053    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
1054    ///   information.
1055    ///
1056    /// ## Thread safety
1057    /// It is safe to call this function from any thread.
1058    ///
1059    /// ## Availability
1060    /// This function is available since SDL 3.2.0.
1061    ///
1062    /// ## See also
1063    /// - [`SDL_SaveFile_IO`]
1064    /// - [`SDL_LoadFile`]
1065    pub fn SDL_SaveFile(
1066        file: *const ::core::ffi::c_char,
1067        data: *const ::core::ffi::c_void,
1068        datasize: ::core::primitive::usize,
1069    ) -> ::core::primitive::bool;
1070}
1071
1072unsafe extern "C" {
1073    /// Use this function to read a byte from an [`SDL_IOStream`].
1074    ///
1075    /// This function will return false when the data stream is completely read,
1076    /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned
1077    /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different
1078    /// error value and [`SDL_GetError()`] will offer a human-readable message.
1079    ///
1080    /// ## Parameters
1081    /// - `src`: the [`SDL_IOStream`] to read from.
1082    /// - `value`: a pointer filled in with the data read.
1083    ///
1084    /// ## Return value
1085    /// Returns true on success or false on failure or EOF; call [`SDL_GetError()`]
1086    ///   for more information.
1087    ///
1088    /// ## Thread safety
1089    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1090    ///
1091    /// ## Availability
1092    /// This function is available since SDL 3.2.0.
1093    pub fn SDL_ReadU8(src: *mut SDL_IOStream, value: *mut Uint8) -> ::core::primitive::bool;
1094}
1095
1096unsafe extern "C" {
1097    /// Use this function to read a signed byte from an [`SDL_IOStream`].
1098    ///
1099    /// This function will return false when the data stream is completely read,
1100    /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned
1101    /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different
1102    /// error value and [`SDL_GetError()`] will offer a human-readable message.
1103    ///
1104    /// ## Parameters
1105    /// - `src`: the [`SDL_IOStream`] to read from.
1106    /// - `value`: a pointer filled in with the data read.
1107    ///
1108    /// ## Return value
1109    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
1110    ///   information.
1111    ///
1112    /// ## Thread safety
1113    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1114    ///
1115    /// ## Availability
1116    /// This function is available since SDL 3.2.0.
1117    pub fn SDL_ReadS8(src: *mut SDL_IOStream, value: *mut Sint8) -> ::core::primitive::bool;
1118}
1119
1120unsafe extern "C" {
1121    /// Use this function to read 16 bits of little-endian data from an
1122    /// [`SDL_IOStream`] and return in native format.
1123    ///
1124    /// SDL byteswaps the data only if necessary, so the data returned will be in
1125    /// the native byte order.
1126    ///
1127    /// This function will return false when the data stream is completely read,
1128    /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned
1129    /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different
1130    /// error value and [`SDL_GetError()`] will offer a human-readable message.
1131    ///
1132    /// ## Parameters
1133    /// - `src`: the stream from which to read data.
1134    /// - `value`: a pointer filled in with the data read.
1135    ///
1136    /// ## Return value
1137    /// Returns true on successful read or false on failure; call [`SDL_GetError()`]
1138    ///   for more information.
1139    ///
1140    /// ## Thread safety
1141    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1142    ///
1143    /// ## Availability
1144    /// This function is available since SDL 3.2.0.
1145    pub fn SDL_ReadU16LE(src: *mut SDL_IOStream, value: *mut Uint16) -> ::core::primitive::bool;
1146}
1147
1148unsafe extern "C" {
1149    /// Use this function to read 16 bits of little-endian data from an
1150    /// [`SDL_IOStream`] and return in native format.
1151    ///
1152    /// SDL byteswaps the data only if necessary, so the data returned will be in
1153    /// the native byte order.
1154    ///
1155    /// This function will return false when the data stream is completely read,
1156    /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned
1157    /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different
1158    /// error value and [`SDL_GetError()`] will offer a human-readable message.
1159    ///
1160    /// ## Parameters
1161    /// - `src`: the stream from which to read data.
1162    /// - `value`: a pointer filled in with the data read.
1163    ///
1164    /// ## Return value
1165    /// Returns true on successful read or false on failure; call [`SDL_GetError()`]
1166    ///   for more information.
1167    ///
1168    /// ## Thread safety
1169    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1170    ///
1171    /// ## Availability
1172    /// This function is available since SDL 3.2.0.
1173    pub fn SDL_ReadS16LE(src: *mut SDL_IOStream, value: *mut Sint16) -> ::core::primitive::bool;
1174}
1175
1176unsafe extern "C" {
1177    /// Use this function to read 16 bits of big-endian data from an [`SDL_IOStream`]
1178    /// and return in native format.
1179    ///
1180    /// SDL byteswaps the data only if necessary, so the data returned will be in
1181    /// the native byte order.
1182    ///
1183    /// This function will return false when the data stream is completely read,
1184    /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned
1185    /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different
1186    /// error value and [`SDL_GetError()`] will offer a human-readable message.
1187    ///
1188    /// ## Parameters
1189    /// - `src`: the stream from which to read data.
1190    /// - `value`: a pointer filled in with the data read.
1191    ///
1192    /// ## Return value
1193    /// Returns true on successful read or false on failure; call [`SDL_GetError()`]
1194    ///   for more information.
1195    ///
1196    /// ## Thread safety
1197    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1198    ///
1199    /// ## Availability
1200    /// This function is available since SDL 3.2.0.
1201    pub fn SDL_ReadU16BE(src: *mut SDL_IOStream, value: *mut Uint16) -> ::core::primitive::bool;
1202}
1203
1204unsafe extern "C" {
1205    /// Use this function to read 16 bits of big-endian data from an [`SDL_IOStream`]
1206    /// and return in native format.
1207    ///
1208    /// SDL byteswaps the data only if necessary, so the data returned will be in
1209    /// the native byte order.
1210    ///
1211    /// This function will return false when the data stream is completely read,
1212    /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned
1213    /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different
1214    /// error value and [`SDL_GetError()`] will offer a human-readable message.
1215    ///
1216    /// ## Parameters
1217    /// - `src`: the stream from which to read data.
1218    /// - `value`: a pointer filled in with the data read.
1219    ///
1220    /// ## Return value
1221    /// Returns true on successful read or false on failure; call [`SDL_GetError()`]
1222    ///   for more information.
1223    ///
1224    /// ## Thread safety
1225    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1226    ///
1227    /// ## Availability
1228    /// This function is available since SDL 3.2.0.
1229    pub fn SDL_ReadS16BE(src: *mut SDL_IOStream, value: *mut Sint16) -> ::core::primitive::bool;
1230}
1231
1232unsafe extern "C" {
1233    /// Use this function to read 32 bits of little-endian data from an
1234    /// [`SDL_IOStream`] and return in native format.
1235    ///
1236    /// SDL byteswaps the data only if necessary, so the data returned will be in
1237    /// the native byte order.
1238    ///
1239    /// This function will return false when the data stream is completely read,
1240    /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned
1241    /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different
1242    /// error value and [`SDL_GetError()`] will offer a human-readable message.
1243    ///
1244    /// ## Parameters
1245    /// - `src`: the stream from which to read data.
1246    /// - `value`: a pointer filled in with the data read.
1247    ///
1248    /// ## Return value
1249    /// Returns true on successful read or false on failure; call [`SDL_GetError()`]
1250    ///   for more information.
1251    ///
1252    /// ## Thread safety
1253    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1254    ///
1255    /// ## Availability
1256    /// This function is available since SDL 3.2.0.
1257    pub fn SDL_ReadU32LE(src: *mut SDL_IOStream, value: *mut Uint32) -> ::core::primitive::bool;
1258}
1259
1260unsafe extern "C" {
1261    /// Use this function to read 32 bits of little-endian data from an
1262    /// [`SDL_IOStream`] and return in native format.
1263    ///
1264    /// SDL byteswaps the data only if necessary, so the data returned will be in
1265    /// the native byte order.
1266    ///
1267    /// This function will return false when the data stream is completely read,
1268    /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned
1269    /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different
1270    /// error value and [`SDL_GetError()`] will offer a human-readable message.
1271    ///
1272    /// ## Parameters
1273    /// - `src`: the stream from which to read data.
1274    /// - `value`: a pointer filled in with the data read.
1275    ///
1276    /// ## Return value
1277    /// Returns true on successful read or false on failure; call [`SDL_GetError()`]
1278    ///   for more information.
1279    ///
1280    /// ## Thread safety
1281    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1282    ///
1283    /// ## Availability
1284    /// This function is available since SDL 3.2.0.
1285    pub fn SDL_ReadS32LE(src: *mut SDL_IOStream, value: *mut Sint32) -> ::core::primitive::bool;
1286}
1287
1288unsafe extern "C" {
1289    /// Use this function to read 32 bits of big-endian data from an [`SDL_IOStream`]
1290    /// and return in native format.
1291    ///
1292    /// SDL byteswaps the data only if necessary, so the data returned will be in
1293    /// the native byte order.
1294    ///
1295    /// This function will return false when the data stream is completely read,
1296    /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned
1297    /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different
1298    /// error value and [`SDL_GetError()`] will offer a human-readable message.
1299    ///
1300    /// ## Parameters
1301    /// - `src`: the stream from which to read data.
1302    /// - `value`: a pointer filled in with the data read.
1303    ///
1304    /// ## Return value
1305    /// Returns true on successful read or false on failure; call [`SDL_GetError()`]
1306    ///   for more information.
1307    ///
1308    /// ## Thread safety
1309    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1310    ///
1311    /// ## Availability
1312    /// This function is available since SDL 3.2.0.
1313    pub fn SDL_ReadU32BE(src: *mut SDL_IOStream, value: *mut Uint32) -> ::core::primitive::bool;
1314}
1315
1316unsafe extern "C" {
1317    /// Use this function to read 32 bits of big-endian data from an [`SDL_IOStream`]
1318    /// and return in native format.
1319    ///
1320    /// SDL byteswaps the data only if necessary, so the data returned will be in
1321    /// the native byte order.
1322    ///
1323    /// This function will return false when the data stream is completely read,
1324    /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned
1325    /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different
1326    /// error value and [`SDL_GetError()`] will offer a human-readable message.
1327    ///
1328    /// ## Parameters
1329    /// - `src`: the stream from which to read data.
1330    /// - `value`: a pointer filled in with the data read.
1331    ///
1332    /// ## Return value
1333    /// Returns true on successful read or false on failure; call [`SDL_GetError()`]
1334    ///   for more information.
1335    ///
1336    /// ## Thread safety
1337    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1338    ///
1339    /// ## Availability
1340    /// This function is available since SDL 3.2.0.
1341    pub fn SDL_ReadS32BE(src: *mut SDL_IOStream, value: *mut Sint32) -> ::core::primitive::bool;
1342}
1343
1344unsafe extern "C" {
1345    /// Use this function to read 64 bits of little-endian data from an
1346    /// [`SDL_IOStream`] and return in native format.
1347    ///
1348    /// SDL byteswaps the data only if necessary, so the data returned will be in
1349    /// the native byte order.
1350    ///
1351    /// This function will return false when the data stream is completely read,
1352    /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned
1353    /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different
1354    /// error value and [`SDL_GetError()`] will offer a human-readable message.
1355    ///
1356    /// ## Parameters
1357    /// - `src`: the stream from which to read data.
1358    /// - `value`: a pointer filled in with the data read.
1359    ///
1360    /// ## Return value
1361    /// Returns true on successful read or false on failure; call [`SDL_GetError()`]
1362    ///   for more information.
1363    ///
1364    /// ## Thread safety
1365    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1366    ///
1367    /// ## Availability
1368    /// This function is available since SDL 3.2.0.
1369    pub fn SDL_ReadU64LE(src: *mut SDL_IOStream, value: *mut Uint64) -> ::core::primitive::bool;
1370}
1371
1372unsafe extern "C" {
1373    /// Use this function to read 64 bits of little-endian data from an
1374    /// [`SDL_IOStream`] and return in native format.
1375    ///
1376    /// SDL byteswaps the data only if necessary, so the data returned will be in
1377    /// the native byte order.
1378    ///
1379    /// This function will return false when the data stream is completely read,
1380    /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned
1381    /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different
1382    /// error value and [`SDL_GetError()`] will offer a human-readable message.
1383    ///
1384    /// ## Parameters
1385    /// - `src`: the stream from which to read data.
1386    /// - `value`: a pointer filled in with the data read.
1387    ///
1388    /// ## Return value
1389    /// Returns true on successful read or false on failure; call [`SDL_GetError()`]
1390    ///   for more information.
1391    ///
1392    /// ## Thread safety
1393    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1394    ///
1395    /// ## Availability
1396    /// This function is available since SDL 3.2.0.
1397    pub fn SDL_ReadS64LE(src: *mut SDL_IOStream, value: *mut Sint64) -> ::core::primitive::bool;
1398}
1399
1400unsafe extern "C" {
1401    /// Use this function to read 64 bits of big-endian data from an [`SDL_IOStream`]
1402    /// and return in native format.
1403    ///
1404    /// SDL byteswaps the data only if necessary, so the data returned will be in
1405    /// the native byte order.
1406    ///
1407    /// This function will return false when the data stream is completely read,
1408    /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned
1409    /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different
1410    /// error value and [`SDL_GetError()`] will offer a human-readable message.
1411    ///
1412    /// ## Parameters
1413    /// - `src`: the stream from which to read data.
1414    /// - `value`: a pointer filled in with the data read.
1415    ///
1416    /// ## Return value
1417    /// Returns true on successful read or false on failure; call [`SDL_GetError()`]
1418    ///   for more information.
1419    ///
1420    /// ## Thread safety
1421    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1422    ///
1423    /// ## Availability
1424    /// This function is available since SDL 3.2.0.
1425    pub fn SDL_ReadU64BE(src: *mut SDL_IOStream, value: *mut Uint64) -> ::core::primitive::bool;
1426}
1427
1428unsafe extern "C" {
1429    /// Use this function to read 64 bits of big-endian data from an [`SDL_IOStream`]
1430    /// and return in native format.
1431    ///
1432    /// SDL byteswaps the data only if necessary, so the data returned will be in
1433    /// the native byte order.
1434    ///
1435    /// This function will return false when the data stream is completely read,
1436    /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned
1437    /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different
1438    /// error value and [`SDL_GetError()`] will offer a human-readable message.
1439    ///
1440    /// ## Parameters
1441    /// - `src`: the stream from which to read data.
1442    /// - `value`: a pointer filled in with the data read.
1443    ///
1444    /// ## Return value
1445    /// Returns true on successful read or false on failure; call [`SDL_GetError()`]
1446    ///   for more information.
1447    ///
1448    /// ## Thread safety
1449    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1450    ///
1451    /// ## Availability
1452    /// This function is available since SDL 3.2.0.
1453    pub fn SDL_ReadS64BE(src: *mut SDL_IOStream, value: *mut Sint64) -> ::core::primitive::bool;
1454}
1455
1456unsafe extern "C" {
1457    /// Use this function to write a byte to an [`SDL_IOStream`].
1458    ///
1459    /// ## Parameters
1460    /// - `dst`: the [`SDL_IOStream`] to write to.
1461    /// - `value`: the byte value to write.
1462    ///
1463    /// ## Return value
1464    /// Returns true on successful write or false on failure; call [`SDL_GetError()`]
1465    ///   for more information.
1466    ///
1467    /// ## Thread safety
1468    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1469    ///
1470    /// ## Availability
1471    /// This function is available since SDL 3.2.0.
1472    pub fn SDL_WriteU8(dst: *mut SDL_IOStream, value: Uint8) -> ::core::primitive::bool;
1473}
1474
1475unsafe extern "C" {
1476    /// Use this function to write a signed byte to an [`SDL_IOStream`].
1477    ///
1478    /// ## Parameters
1479    /// - `dst`: the [`SDL_IOStream`] to write to.
1480    /// - `value`: the byte value to write.
1481    ///
1482    /// ## Return value
1483    /// Returns true on successful write or false on failure; call [`SDL_GetError()`]
1484    ///   for more information.
1485    ///
1486    /// ## Thread safety
1487    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1488    ///
1489    /// ## Availability
1490    /// This function is available since SDL 3.2.0.
1491    pub fn SDL_WriteS8(dst: *mut SDL_IOStream, value: Sint8) -> ::core::primitive::bool;
1492}
1493
1494unsafe extern "C" {
1495    /// Use this function to write 16 bits in native format to an [`SDL_IOStream`] as
1496    /// little-endian data.
1497    ///
1498    /// SDL byteswaps the data only if necessary, so the application always
1499    /// specifies native format, and the data written will be in little-endian
1500    /// format.
1501    ///
1502    /// ## Parameters
1503    /// - `dst`: the stream to which data will be written.
1504    /// - `value`: the data to be written, in native format.
1505    ///
1506    /// ## Return value
1507    /// Returns true on successful write or false on failure; call [`SDL_GetError()`]
1508    ///   for more information.
1509    ///
1510    /// ## Thread safety
1511    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1512    ///
1513    /// ## Availability
1514    /// This function is available since SDL 3.2.0.
1515    pub fn SDL_WriteU16LE(dst: *mut SDL_IOStream, value: Uint16) -> ::core::primitive::bool;
1516}
1517
1518unsafe extern "C" {
1519    /// Use this function to write 16 bits in native format to an [`SDL_IOStream`] as
1520    /// little-endian data.
1521    ///
1522    /// SDL byteswaps the data only if necessary, so the application always
1523    /// specifies native format, and the data written will be in little-endian
1524    /// format.
1525    ///
1526    /// ## Parameters
1527    /// - `dst`: the stream to which data will be written.
1528    /// - `value`: the data to be written, in native format.
1529    ///
1530    /// ## Return value
1531    /// Returns true on successful write or false on failure; call [`SDL_GetError()`]
1532    ///   for more information.
1533    ///
1534    /// ## Thread safety
1535    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1536    ///
1537    /// ## Availability
1538    /// This function is available since SDL 3.2.0.
1539    pub fn SDL_WriteS16LE(dst: *mut SDL_IOStream, value: Sint16) -> ::core::primitive::bool;
1540}
1541
1542unsafe extern "C" {
1543    /// Use this function to write 16 bits in native format to an [`SDL_IOStream`] as
1544    /// big-endian data.
1545    ///
1546    /// SDL byteswaps the data only if necessary, so the application always
1547    /// specifies native format, and the data written will be in big-endian format.
1548    ///
1549    /// ## Parameters
1550    /// - `dst`: the stream to which data will be written.
1551    /// - `value`: the data to be written, in native format.
1552    ///
1553    /// ## Return value
1554    /// Returns true on successful write or false on failure; call [`SDL_GetError()`]
1555    ///   for more information.
1556    ///
1557    /// ## Thread safety
1558    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1559    ///
1560    /// ## Availability
1561    /// This function is available since SDL 3.2.0.
1562    pub fn SDL_WriteU16BE(dst: *mut SDL_IOStream, value: Uint16) -> ::core::primitive::bool;
1563}
1564
1565unsafe extern "C" {
1566    /// Use this function to write 16 bits in native format to an [`SDL_IOStream`] as
1567    /// big-endian data.
1568    ///
1569    /// SDL byteswaps the data only if necessary, so the application always
1570    /// specifies native format, and the data written will be in big-endian format.
1571    ///
1572    /// ## Parameters
1573    /// - `dst`: the stream to which data will be written.
1574    /// - `value`: the data to be written, in native format.
1575    ///
1576    /// ## Return value
1577    /// Returns true on successful write or false on failure; call [`SDL_GetError()`]
1578    ///   for more information.
1579    ///
1580    /// ## Thread safety
1581    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1582    ///
1583    /// ## Availability
1584    /// This function is available since SDL 3.2.0.
1585    pub fn SDL_WriteS16BE(dst: *mut SDL_IOStream, value: Sint16) -> ::core::primitive::bool;
1586}
1587
1588unsafe extern "C" {
1589    /// Use this function to write 32 bits in native format to an [`SDL_IOStream`] as
1590    /// little-endian data.
1591    ///
1592    /// SDL byteswaps the data only if necessary, so the application always
1593    /// specifies native format, and the data written will be in little-endian
1594    /// format.
1595    ///
1596    /// ## Parameters
1597    /// - `dst`: the stream to which data will be written.
1598    /// - `value`: the data to be written, in native format.
1599    ///
1600    /// ## Return value
1601    /// Returns true on successful write or false on failure; call [`SDL_GetError()`]
1602    ///   for more information.
1603    ///
1604    /// ## Thread safety
1605    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1606    ///
1607    /// ## Availability
1608    /// This function is available since SDL 3.2.0.
1609    pub fn SDL_WriteU32LE(dst: *mut SDL_IOStream, value: Uint32) -> ::core::primitive::bool;
1610}
1611
1612unsafe extern "C" {
1613    /// Use this function to write 32 bits in native format to an [`SDL_IOStream`] as
1614    /// little-endian data.
1615    ///
1616    /// SDL byteswaps the data only if necessary, so the application always
1617    /// specifies native format, and the data written will be in little-endian
1618    /// format.
1619    ///
1620    /// ## Parameters
1621    /// - `dst`: the stream to which data will be written.
1622    /// - `value`: the data to be written, in native format.
1623    ///
1624    /// ## Return value
1625    /// Returns true on successful write or false on failure; call [`SDL_GetError()`]
1626    ///   for more information.
1627    ///
1628    /// ## Thread safety
1629    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1630    ///
1631    /// ## Availability
1632    /// This function is available since SDL 3.2.0.
1633    pub fn SDL_WriteS32LE(dst: *mut SDL_IOStream, value: Sint32) -> ::core::primitive::bool;
1634}
1635
1636unsafe extern "C" {
1637    /// Use this function to write 32 bits in native format to an [`SDL_IOStream`] as
1638    /// big-endian data.
1639    ///
1640    /// SDL byteswaps the data only if necessary, so the application always
1641    /// specifies native format, and the data written will be in big-endian format.
1642    ///
1643    /// ## Parameters
1644    /// - `dst`: the stream to which data will be written.
1645    /// - `value`: the data to be written, in native format.
1646    ///
1647    /// ## Return value
1648    /// Returns true on successful write or false on failure; call [`SDL_GetError()`]
1649    ///   for more information.
1650    ///
1651    /// ## Thread safety
1652    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1653    ///
1654    /// ## Availability
1655    /// This function is available since SDL 3.2.0.
1656    pub fn SDL_WriteU32BE(dst: *mut SDL_IOStream, value: Uint32) -> ::core::primitive::bool;
1657}
1658
1659unsafe extern "C" {
1660    /// Use this function to write 32 bits in native format to an [`SDL_IOStream`] as
1661    /// big-endian data.
1662    ///
1663    /// SDL byteswaps the data only if necessary, so the application always
1664    /// specifies native format, and the data written will be in big-endian format.
1665    ///
1666    /// ## Parameters
1667    /// - `dst`: the stream to which data will be written.
1668    /// - `value`: the data to be written, in native format.
1669    ///
1670    /// ## Return value
1671    /// Returns true on successful write or false on failure; call [`SDL_GetError()`]
1672    ///   for more information.
1673    ///
1674    /// ## Thread safety
1675    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1676    ///
1677    /// ## Availability
1678    /// This function is available since SDL 3.2.0.
1679    pub fn SDL_WriteS32BE(dst: *mut SDL_IOStream, value: Sint32) -> ::core::primitive::bool;
1680}
1681
1682unsafe extern "C" {
1683    /// Use this function to write 64 bits in native format to an [`SDL_IOStream`] as
1684    /// little-endian data.
1685    ///
1686    /// SDL byteswaps the data only if necessary, so the application always
1687    /// specifies native format, and the data written will be in little-endian
1688    /// format.
1689    ///
1690    /// ## Parameters
1691    /// - `dst`: the stream to which data will be written.
1692    /// - `value`: the data to be written, in native format.
1693    ///
1694    /// ## Return value
1695    /// Returns true on successful write or false on failure; call [`SDL_GetError()`]
1696    ///   for more information.
1697    ///
1698    /// ## Thread safety
1699    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1700    ///
1701    /// ## Availability
1702    /// This function is available since SDL 3.2.0.
1703    pub fn SDL_WriteU64LE(dst: *mut SDL_IOStream, value: Uint64) -> ::core::primitive::bool;
1704}
1705
1706unsafe extern "C" {
1707    /// Use this function to write 64 bits in native format to an [`SDL_IOStream`] as
1708    /// little-endian data.
1709    ///
1710    /// SDL byteswaps the data only if necessary, so the application always
1711    /// specifies native format, and the data written will be in little-endian
1712    /// format.
1713    ///
1714    /// ## Parameters
1715    /// - `dst`: the stream to which data will be written.
1716    /// - `value`: the data to be written, in native format.
1717    ///
1718    /// ## Return value
1719    /// Returns true on successful write or false on failure; call [`SDL_GetError()`]
1720    ///   for more information.
1721    ///
1722    /// ## Thread safety
1723    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1724    ///
1725    /// ## Availability
1726    /// This function is available since SDL 3.2.0.
1727    pub fn SDL_WriteS64LE(dst: *mut SDL_IOStream, value: Sint64) -> ::core::primitive::bool;
1728}
1729
1730unsafe extern "C" {
1731    /// Use this function to write 64 bits in native format to an [`SDL_IOStream`] as
1732    /// big-endian data.
1733    ///
1734    /// SDL byteswaps the data only if necessary, so the application always
1735    /// specifies native format, and the data written will be in big-endian format.
1736    ///
1737    /// ## Parameters
1738    /// - `dst`: the stream to which data will be written.
1739    /// - `value`: the data to be written, in native format.
1740    ///
1741    /// ## Return value
1742    /// Returns true on successful write or false on failure; call [`SDL_GetError()`]
1743    ///   for more information.
1744    ///
1745    /// ## Thread safety
1746    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1747    ///
1748    /// ## Availability
1749    /// This function is available since SDL 3.2.0.
1750    pub fn SDL_WriteU64BE(dst: *mut SDL_IOStream, value: Uint64) -> ::core::primitive::bool;
1751}
1752
1753unsafe extern "C" {
1754    /// Use this function to write 64 bits in native format to an [`SDL_IOStream`] as
1755    /// big-endian data.
1756    ///
1757    /// SDL byteswaps the data only if necessary, so the application always
1758    /// specifies native format, and the data written will be in big-endian format.
1759    ///
1760    /// ## Parameters
1761    /// - `dst`: the stream to which data will be written.
1762    /// - `value`: the data to be written, in native format.
1763    ///
1764    /// ## Return value
1765    /// Returns true on successful write or false on failure; call [`SDL_GetError()`]
1766    ///   for more information.
1767    ///
1768    /// ## Thread safety
1769    /// Do not use the same [`SDL_IOStream`] from two threads at once.
1770    ///
1771    /// ## Availability
1772    /// This function is available since SDL 3.2.0.
1773    pub fn SDL_WriteS64BE(dst: *mut SDL_IOStream, value: Sint64) -> ::core::primitive::bool;
1774}
1775
1776/// The read/write operation structure.
1777///
1778/// This operates as an opaque handle. There are several APIs to create various
1779/// types of I/O streams, or an app can supply an [`SDL_IOStreamInterface`] to
1780/// [`SDL_OpenIO()`] to provide their own stream implementation behind this
1781/// struct's abstract interface.
1782///
1783/// ## Availability
1784/// This struct is available since SDL 3.2.0.
1785#[repr(C)]
1786pub struct SDL_IOStream {
1787    _opaque: [::core::primitive::u8; 0],
1788}
1789
1790#[cfg(doc)]
1791use crate::everything::*;