mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-15 06:24:01 +00:00
fd_monitor.rs: make NativeCallback public
The upcoming io.rs calls "FdMonitorItem::new". We cannot pass a closure, we must pass an object of type NativeCallback.
This commit is contained in:
parent
7069455e68
commit
91008acd3e
1 changed files with 2 additions and 1 deletions
|
@ -18,6 +18,7 @@ mod fd_monitor_ffi {
|
||||||
/// Reason for waking an item
|
/// Reason for waking an item
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
#[cxx_name = "item_wake_reason_t"]
|
#[cxx_name = "item_wake_reason_t"]
|
||||||
|
#[derive(PartialEq, Eq)]
|
||||||
enum ItemWakeReason {
|
enum ItemWakeReason {
|
||||||
/// The fd became readable (or was HUP'd)
|
/// The fd became readable (or was HUP'd)
|
||||||
Readable,
|
Readable,
|
||||||
|
@ -107,7 +108,7 @@ impl From<u64> for FdMonitorItemId {
|
||||||
}
|
}
|
||||||
|
|
||||||
type FfiCallback = extern "C" fn(*mut AutoCloseFd, u8, void_ptr);
|
type FfiCallback = extern "C" fn(*mut AutoCloseFd, u8, void_ptr);
|
||||||
type NativeCallback = Box<dyn Fn(&mut AutoCloseFd, ItemWakeReason) + Send + Sync>;
|
pub type NativeCallback = Box<dyn Fn(&mut AutoCloseFd, ItemWakeReason) + Send + Sync>;
|
||||||
|
|
||||||
/// The callback type used by [`FdMonitorItem`]. It is passed a mutable reference to the
|
/// The callback type used by [`FdMonitorItem`]. It is passed a mutable reference to the
|
||||||
/// `FdMonitorItem`'s [`FdMonitorItem::fd`] and [the reason](ItemWakeupReason) for the wakeup. The
|
/// `FdMonitorItem`'s [`FdMonitorItem::fd`] and [the reason](ItemWakeupReason) for the wakeup. The
|
||||||
|
|
Loading…
Reference in a new issue