libnotcurses_sys/fd/
mod.rs

1// functions already exported by bindgen : 8
2// -----------------------------------------
3// (W) wrap: 0
4// (#) test: 0
5// -----------------------------------------
6//   ncfdplane_create
7//   ncfdplane_destroy
8//   ncfdplane_plane
9//   ncsubproc_createv,
10//   ncsubproc_createvp,
11//   ncsubproc_createvpe,
12//   ncsubproc_destroy,
13//   ncsubproc_plane,
14
15//! from: <https://notcurses.com/notcurses_fds.3.html>
16//!
17//! These widgets cause a file descriptor to be read until EOF, and written to a
18//! scrolling ncplane. The reading will take place in a notcurses-managed
19//! context (the particulars of this context are not defined, and should not be
20//! depended upon), which will invoke the provided callbacks with the data read.
21//!
22//! Essentially, they are simply portable interfaces to asynchronous reading,
23//! with ncsubproc also providing subprocess management.
24//!
25//! If ncsubproc_destroy is called before the subprocess has exited, it will be
26//! sent a SIGKILL. If ncsubproc_destroy or ncfdplane_destroy is called while a
27//! callback is being invoked, the destroy function will block until the
28//! callback is done being invoked. If a user callback returns non-0, the
29//! calling object will destroy itself. If a user callback calls the relevant
30//! destroy function itself, the thread will exit as if non-0 had been returned,
31//! and the ncsubproc's resources will at that time be reclaimed.
32//!
33//! It is essential that the destroy function be called once and only once,
34//! whether it is from within the thread's context, or external to that context.
35
36use crate::c_api::ffi;
37
38mod methods;
39
40/// A raw file descriptor, as returned by [`Nc.inputready_fd`] and
41/// [`NcDirect.inputready_fd`].
42///
43/// [`Nc.inputready_fd`]: crate::Nc#method.inputready_fd
44/// [`NcDirect.inputready_fd`]: crate::Nc#method.inputready_fd
45pub type NcFd = i32;
46
47/// I/O wrapper to dump file descriptor to [`NcPlane`][crate::NcPlane].
48///
49/// `type in C: ncfdplane (struct)`
50pub type NcFdPlane = ffi::ncfdplane;
51
52/// Options struct for [`NcFdPlane`].
53///
54/// `type in C: ncfdplane_options (struct)`
55pub type NcFdPlaneOptions = ffi::ncfdplane_options;
56
57/// [`NcFdPlane`] wrapper with subprocess management.
58///
59/// `type in C: ncsubproc (struct)`
60pub type NcSubproc = ffi::ncsubproc;
61
62/// Options struct for [`NcSubproc`]
63///
64/// `type in C: ncsubproc_options (struct)`
65pub type NcSubprocOptions = ffi::ncsubproc_options;