Skip to main content

gio_unix/auto/
output_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 file
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 writes to.
24    ///
25    /// Readable | Writable | Construct Only
26    ///
27    /// # Implements
28    ///
29    /// [`UnixOutputStreamExt`][trait@crate::prelude::UnixOutputStreamExt], [`trait@gio::prelude::OutputStreamExt`], [`trait@gio::prelude::PollableOutputStreamExt`], [`FileDescriptorBasedExt`][trait@crate::prelude::FileDescriptorBasedExt], [`UnixOutputStreamExtManual`][trait@crate::prelude::UnixOutputStreamExtManual], [`FileDescriptorBasedExtManual`][trait@crate::prelude::FileDescriptorBasedExtManual]
30    #[doc(alias = "GUnixOutputStream")]
31    pub struct OutputStream(Object<ffi::GUnixOutputStream, ffi::GUnixOutputStreamClass>) @extends gio::OutputStream, @implements gio::PollableOutputStream, FileDescriptorBased;
32
33    match fn {
34        type_ => || ffi::g_unix_output_stream_get_type(),
35    }
36}
37
38impl OutputStream {
39    pub const NONE: Option<&'static OutputStream> = None;
40}
41
42/// Trait containing all [`struct@OutputStream`] methods.
43///
44/// # Implementors
45///
46/// [`OutputStream`][struct@crate::OutputStream]
47pub trait UnixOutputStreamExt: IsA<OutputStream> + '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_output_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_output_stream_get_close_fd(
60                self.as_ref().to_glib_none().0,
61            ))
62        }
63    }
64}
65
66impl<O: IsA<OutputStream>> UnixOutputStreamExt for O {}