lib: add repo_checkout_filter function for better ergonomics

This commit is contained in:
Felix Krull authored and Colin Walters committed 2022-05-06 12:53:54 -04:00
1 parent 903bd86e52
commit e39f8d7461
3 files changed
+16 -13

No files matched your search

@@ -7,6 +7,14 @@ use std::path::{Path, PathBuf};
pub type RepoCheckoutFilter = Box<dyn Fn(&Repo, &Path, &libc::stat) -> RepoCheckoutFilterResult>;
pub fn repo_checkout_filter<F>(closure: F) -> Option<RepoCheckoutFilter>
where
F: 'static,
F: Fn(&Repo, &Path, &libc::stat) -> RepoCheckoutFilterResult,
{
Some(Box::new(closure))
}
unsafe extern "C" fn filter_trampoline(
repo: *mut OstreeRepo,
path: *const c_char,