maint: Move to /rust/* to /
This makes it easier for tooling to find the Rust stuff. Rust/non-rust is not a useful distinction in this repo anymore anyway.
This commit is contained in:
parent
8c64b5e380
commit
55eacf43c3
33 changed files with 5 additions and 5 deletions
38
nix-bindings-fetchers/src/lib.rs
Normal file
38
nix-bindings-fetchers/src/lib.rs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
use anyhow::{Context as _, Result};
|
||||
use nix_bindings_bindgen_raw as raw;
|
||||
use nix_bindings_util::context::{self, Context};
|
||||
use std::ptr::NonNull;
|
||||
|
||||
pub struct FetchersSettings {
|
||||
pub(crate) ptr: NonNull<raw::fetchers_settings>,
|
||||
}
|
||||
impl Drop for FetchersSettings {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
raw::fetchers_settings_free(self.ptr.as_ptr());
|
||||
}
|
||||
}
|
||||
}
|
||||
impl FetchersSettings {
|
||||
pub fn new() -> Result<Self> {
|
||||
let mut ctx = Context::new();
|
||||
let ptr = unsafe { context::check_call!(raw::fetchers_settings_new(&mut ctx))? };
|
||||
Ok(FetchersSettings {
|
||||
ptr: NonNull::new(ptr).context("fetchers_settings_new unexpectedly returned null")?,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn raw_ptr(&self) -> *mut raw::fetchers_settings {
|
||||
self.ptr.as_ptr()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn fetchers_settings_new() {
|
||||
let _ = FetchersSettings::new().unwrap();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue