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
48/// Trait containing all [`struct@UnixInputStream`] methods.
49///
50/// # Implementors
51///
52/// [`UnixInputStream`][struct@crate::UnixInputStream]
53pub trait UnixInputStreamExt: IsA<UnixInputStream> + 'static {
54 /// Returns whether the file descriptor of @self will be
55 /// closed when the stream is closed.
56 ///
57 /// # Returns
58 ///
59 /// [`true`] if the file descriptor is closed when done
60 #[doc(alias = "g_unix_input_stream_get_close_fd")]
61 #[doc(alias = "get_close_fd")]
62 #[doc(alias = "close-fd")]
63 fn closes_fd(&self) -> bool {
64 unsafe {
65 from_glib(ffi::g_unix_input_stream_get_close_fd(
66 self.as_ref().to_glib_none().0,
67 ))
68 }
69 }
70}
71
72impl<O: IsA<UnixInputStream>> UnixInputStreamExt for O {}