gio/auto/unix_input_stream.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{ffi, FileDescriptorBased, InputStream, PollableInputStream};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 /// `GUnixInputStream` implements [`InputStream`][crate::InputStream] for reading from a UNIX
10 /// file descriptor, including asynchronous operations. (If the file
11 /// descriptor refers to a socket or pipe, this will use `poll()` to do
12 /// asynchronous I/O. If it refers to a regular file, it will fall back
13 /// to doing asynchronous I/O in another thread.)
14 ///
15 /// Note that `<gio/gunixinputstream.h>` belongs to the UNIX-specific GIO
16 /// interfaces, thus you have to use the `gio-unix-2.0.pc` pkg-config
17 /// file or the `GioUnix-2.0` GIR namespace when using it.
18 ///
19 /// ## Properties
20 ///
21 ///
22 /// #### `close-fd`
23 /// Whether to close the file descriptor when the stream is closed.
24 ///
25 /// Readable | Writeable
26 ///
27 ///
28 /// #### `fd`
29 /// The file descriptor that the stream reads from.
30 ///
31 /// Readable | Writeable | Construct Only
32 ///
33 /// # Implements
34 ///
35 /// [`UnixInputStreamExt`][trait@crate::prelude::UnixInputStreamExt], [`InputStreamExt`][trait@crate::prelude::InputStreamExt], [`trait@glib::ObjectExt`], [`FileDescriptorBasedExt`][trait@crate::prelude::FileDescriptorBasedExt], [`PollableInputStreamExt`][trait@crate::prelude::PollableInputStreamExt], [`UnixInputStreamExtManual`][trait@crate::prelude::UnixInputStreamExtManual], [`InputStreamExtManual`][trait@crate::prelude::InputStreamExtManual], [`FileDescriptorBasedExtManual`][trait@crate::prelude::FileDescriptorBasedExtManual], [`PollableInputStreamExtManual`][trait@crate::prelude::PollableInputStreamExtManual]
36 #[doc(alias = "GUnixInputStream")]
37 pub struct UnixInputStream(Object<ffi::GUnixInputStream, ffi::GUnixInputStreamClass>) @extends InputStream, @implements FileDescriptorBased, PollableInputStream;
38
39 match fn {
40 type_ => || ffi::g_unix_input_stream_get_type(),
41 }
42}
43
44impl UnixInputStream {
45 pub const NONE: Option<&'static UnixInputStream> = None;
46}
47
48mod sealed {
49 pub trait Sealed {}
50 impl<T: super::IsA<super::UnixInputStream>> Sealed for T {}
51}
52
53/// Trait containing all [`struct@UnixInputStream`] methods.
54///
55/// # Implementors
56///
57/// [`UnixInputStream`][struct@crate::UnixInputStream]
58pub trait UnixInputStreamExt: IsA<UnixInputStream> + sealed::Sealed + 'static {
59 /// Returns whether the file descriptor of @self will be
60 /// closed when the stream is closed.
61 ///
62 /// # Returns
63 ///
64 /// [`true`] if the file descriptor is closed when done
65 #[doc(alias = "g_unix_input_stream_get_close_fd")]
66 #[doc(alias = "get_close_fd")]
67 #[doc(alias = "close-fd")]
68 fn closes_fd(&self) -> bool {
69 unsafe {
70 from_glib(ffi::g_unix_input_stream_get_close_fd(
71 self.as_ref().to_glib_none().0,
72 ))
73 }
74 }
75}
76
77impl<O: IsA<UnixInputStream>> UnixInputStreamExt for O {}