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::{ffi, FileDescriptorBased};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 /// `GUnixOutputStream` implements [`gio::OutputStream`][crate::gio::OutputStream] for writing to 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/gunixoutputstream.h>` belongs to the UNIX-specific GIO
16 /// interfaces, thus you have to use the `gio-unix-2.0.pc` pkg-config file
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 writes to.
30 ///
31 /// Readable | Writeable | Construct Only
32 ///
33 /// # Implements
34 ///
35 /// [`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]
36 #[doc(alias = "GUnixOutputStream")]
37 pub struct OutputStream(Object<ffi::GUnixOutputStream, ffi::GUnixOutputStreamClass>) @extends gio::OutputStream, @implements gio::PollableOutputStream, FileDescriptorBased;
38
39 match fn {
40 type_ => || ffi::g_unix_output_stream_get_type(),
41 }
42}
43
44impl OutputStream {
45 pub const NONE: Option<&'static OutputStream> = None;
46}
47
48/// Trait containing all [`struct@OutputStream`] methods.
49///
50/// # Implementors
51///
52/// [`OutputStream`][struct@crate::OutputStream]
53pub trait UnixOutputStreamExt: IsA<OutputStream> + '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_output_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_output_stream_get_close_fd(
66 self.as_ref().to_glib_none().0,
67 ))
68 }
69 }
70}
71
72impl<O: IsA<OutputStream>> UnixOutputStreamExt for O {}