Skip to content

Commit

Permalink
sysroot: Add a method to borrow sysroot fd
Browse files Browse the repository at this point in the history
For the same reason we have this method on `Repo`.
  • Loading branch information
cgwalters committed Dec 1, 2023
1 parent b0be233 commit d3190db
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions rust-bindings/src/sysroot.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use crate::gio;
use crate::Sysroot;
#[cfg(any(feature = "v2017_10", feature = "dox"))]
use std::os::fd::BorrowedFd;
use std::path::PathBuf;

#[derive(Clone, Debug, Default)]
Expand Down Expand Up @@ -62,6 +64,14 @@ impl SysrootBuilder {
}
}

impl Sysroot {
/// Borrow the directory file descriptor for this sysroot.
#[cfg(feature = "v2017_10")]
pub fn dfd_borrow(&self) -> BorrowedFd {
unsafe { BorrowedFd::borrow_raw(self.fd()) }
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down

0 comments on commit d3190db

Please sign in to comment.