mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 09:39:52 +08: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
|
@ -18,6 +18,7 @@ mod fd_monitor_ffi {
|
|||
/// Reason for waking an item
|
||||
#[repr(u8)]
|
||||
#[cxx_name = "item_wake_reason_t"]
|
||||
#[derive(PartialEq, Eq)]
|
||||
enum ItemWakeReason {
|
||||
/// The fd became readable (or was HUP'd)
|
||||
Readable,
|
||||
|
@ -107,7 +108,7 @@ impl From<u64> for FdMonitorItemId {
|
|||
}
|
||||
|
||||
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
|
||||
/// `FdMonitorItem`'s [`FdMonitorItem::fd`] and [the reason](ItemWakeupReason) for the wakeup. The
|
||||
|
|
Loading…
Reference in New Issue
Block a user