gio_unix/auto/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::{FileDescriptorBased, ffi};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 /// ` belongs to the UNIX-specific GIO
10 /// interfaces, thus you have to use the `gio-unix-2.0.pc` pkg-config
11 /// file or the `GioUnix-2.0` GIR namespace when using it.
12 ///
13 /// ## Properties
14 ///
15 ///
16 /// #### `close-fd`
17 /// Whether to close the file descriptor when the stream is closed.
18 ///
19 /// Readable | Writable
20 ///
21 ///
22 /// #### `fd`
23 /// The file descriptor that the stream reads from.
24 ///
25 /// Readable | Writable | Construct Only
26 ///
27 /// # Implements
28 ///
29 /// [`UnixInputStreamExt`][trait@crate::prelude::UnixInputStreamExt], [`trait@gio::prelude::InputStreamExt`], [`trait@gio::prelude::PollableInputStreamExt`], [`FileDescriptorBasedExt`][trait@crate::prelude::FileDescriptorBasedExt], [`UnixInputStreamExtManual`][trait@crate::prelude::UnixInputStreamExtManual], [`FileDescriptorBasedExtManual`][trait@crate::prelude::FileDescriptorBasedExtManual]
30 #[doc(alias = "GUnixInputStream")]
31 pub struct InputStream(Object<ffi::GUnixInputStream, ffi::GUnixInputStreamClass>) @extends gio::InputStream, @implements gio::PollableInputStream, FileDescriptorBased;
32
33 match fn {
34 type_ => || ffi::g_unix_input_stream_get_type(),
35 }
36}
37
38impl InputStream {
39 pub const NONE: Option<&'static InputStream> = None;
40}
41
42/// Trait containing all [`struct@InputStream`] methods.
43///
44/// # Implementors
45///
46/// [`InputStream`][struct@crate::InputStream]
47pub trait UnixInputStreamExt: IsA<InputStream> + 'static {
48 /// Returns whether the file descriptor of @self will be
49 /// closed when the stream is closed.
50 ///
51 /// # Returns
52 ///
53 /// [`true`] if the file descriptor is closed when done
54 #[doc(alias = "g_unix_input_stream_get_close_fd")]
55 #[doc(alias = "get_close_fd")]
56 #[doc(alias = "close-fd")]
57 fn closes_fd(&self) -> bool {
58 unsafe {
59 from_glib(ffi::g_unix_input_stream_get_close_fd(
60 self.as_ref().to_glib_none().0,
61 ))
62 }
63 }
64}
65
66impl<O: IsA<InputStream>> UnixInputStreamExt for O {}