This commit is contained in:
sxyazi 2024-03-09 03:05:37 +08:00
parent 8d92ba3fd1
commit 9b3c56535b
No known key found for this signature in database
2 changed files with 5 additions and 4 deletions

View file

@ -4,6 +4,7 @@ use crate::MERGED_YAZI;
#[derive(Debug)] #[derive(Debug)]
pub struct Headsup { pub struct Headsup {
// TODO: remove this once Yazi 0.3 is released --
pub disable_exec_warn: bool, pub disable_exec_warn: bool,
} }

View file

@ -7,7 +7,7 @@ pub type PermitRef<'lua, F> = mlua::UserDataRef<'lua, Permit<F>>;
pub struct Permit<F: FnOnce()> { pub struct Permit<F: FnOnce()> {
inner: Option<SemaphorePermit<'static>>, inner: Option<SemaphorePermit<'static>>,
callback: Option<F>, destruct: Option<F>,
} }
impl<F: FnOnce()> Deref for Permit<F> { impl<F: FnOnce()> Deref for Permit<F> {
@ -17,12 +17,12 @@ impl<F: FnOnce()> Deref for Permit<F> {
} }
impl<F: FnOnce()> Permit<F> { impl<F: FnOnce()> Permit<F> {
pub fn new(permit: SemaphorePermit<'static>, f: F) -> Self { pub fn new(inner: SemaphorePermit<'static>, f: F) -> Self {
Self { inner: Some(permit), callback: Some(f) } Self { inner: Some(inner), destruct: Some(f) }
} }
fn dropping(&mut self) { fn dropping(&mut self) {
if let Some(f) = self.callback.take() { if let Some(f) = self.destruct.take() {
f(); f();
} }
if let Some(p) = self.inner.take() { if let Some(p) = self.inner.take() {