mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
8d92ba3fd1
commit
9b3c56535b
2 changed files with 5 additions and 4 deletions
|
|
@ -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,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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() {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue