gio/auto/unix_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, OutputStream, PollableOutputStream};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 /// `GUnixOutputStream` implements [`OutputStream`][crate::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], [`OutputStreamExt`][trait@crate::prelude::OutputStreamExt], [`trait@glib::ObjectExt`], [`FileDescriptorBasedExt`][trait@crate::prelude::FileDescriptorBasedExt], [`PollableOutputStreamExt`][trait@crate::prelude::PollableOutputStreamExt], [`UnixOutputStreamExtManual`][trait@crate::prelude::UnixOutputStreamExtManual], [`OutputStreamExtManual`][trait@crate::prelude::OutputStreamExtManual], [`FileDescriptorBasedExtManual`][trait@crate::prelude::FileDescriptorBasedExtManual], [`PollableOutputStreamExtManual`][trait@crate::prelude::PollableOutputStreamExtManual]
36 #[doc(alias = "GUnixOutputStream")]
37 pub struct UnixOutputStream(Object<ffi::GUnixOutputStream, ffi::GUnixOutputStreamClass>) @extends OutputStream, @implements FileDescriptorBased, PollableOutputStream;
38
39 match fn {
40 type_ => || ffi::g_unix_output_stream_get_type(),
41 }
42}
43
44impl UnixOutputStream {
45 pub const NONE: Option<&'static UnixOutputStream> = None;
46}
47
48mod sealed {
49 pub trait Sealed {}
50 impl<T: super::IsA<super::UnixOutputStream>> Sealed for T {}
51}
52
53/// Trait containing all [`struct@UnixOutputStream`] methods.
54///
55/// # Implementors
56///
57/// [`UnixOutputStream`][struct@crate::UnixOutputStream]
58pub trait UnixOutputStreamExt: IsA<UnixOutputStream> + 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_output_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_output_stream_get_close_fd(
71 self.as_ref().to_glib_none().0,
72 ))
73 }
74 }
75}
76
77impl<O: IsA<UnixOutputStream>> UnixOutputStreamExt for O {}