-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
406 additions
and
59 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,4 @@ pub mod data; | |
pub mod exif; | ||
pub mod fanbox; | ||
pub mod json; | ||
#[cfg(feature = "avdict")] | ||
pub mod video; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use subprocess::{ExitStatus, Popen}; | ||
|
||
pub struct PopenAwait<'a> { | ||
pub p: &'a mut Popen, | ||
} | ||
|
||
impl<'a> std::future::Future for PopenAwait<'a> { | ||
type Output = ExitStatus; | ||
fn poll( | ||
self: std::pin::Pin<&mut Self>, | ||
cx: &mut std::task::Context<'_>, | ||
) -> std::task::Poll<Self::Output> { | ||
match self.get_mut().p.poll() { | ||
Some(e) => std::task::Poll::Ready(e), | ||
None => { | ||
cx.waker().wake_by_ref(); | ||
return std::task::Poll::Pending; | ||
} | ||
} | ||
} | ||
} | ||
|
||
impl<'a> From<&'a mut Popen> for PopenAwait<'a> { | ||
fn from(value: &'a mut Popen) -> PopenAwait<'a> { | ||
Self { p: value } | ||
} | ||
} | ||
|
||
pub trait PopenAsyncExt<'a> { | ||
fn async_wait(&'a mut self) -> PopenAwait<'a>; | ||
} | ||
|
||
impl<'a> PopenAsyncExt<'a> for Popen { | ||
fn async_wait(&'a mut self) -> PopenAwait<'a> { | ||
PopenAwait::from(self) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.