Split monolithic raw crates into sys crates

Creating a crate for bwd-gc highlights the fact that it would be nice to
fix 2!

The file blocklist is a lost less unmaintainable then the more
fine-grained one we had before.

Fix #9
This commit is contained in:
John Ericson 2025-12-06 15:44:20 -05:00
parent 485070ffa9
commit dbb00333b1
51 changed files with 571 additions and 104 deletions

View file

@ -113,7 +113,7 @@ macro_rules! check_call_opt_key {
{
let ctx : &mut $crate::context::Context = $ctx;
let ret = $($f)::*(ctx.ptr(), $($arg,)*);
if unsafe { raw::err_code(ctx.ptr()) == raw::err_NIX_ERR_KEY } {
if unsafe { $crate::raw_sys::err_code(ctx.ptr()) == $crate::raw_sys::err_NIX_ERR_KEY } {
ctx.clear();
return Ok(None);
}

View file

@ -3,3 +3,6 @@ pub mod settings;
#[macro_use]
pub mod string_return;
pub mod nix_version;
// Re-export for use in macros
pub use nix_bindings_util_sys as raw_sys;

View file

@ -74,20 +74,20 @@ mod tests {
fn setup() {
let mut ctx = context::Context::new();
unsafe {
check_call!(raw::libstore_init(&mut ctx)).unwrap();
check_call!(nix_bindings_util_sys::libutil_init(&mut ctx)).unwrap();
}
}
#[test]
fn set_get() {
// Something that shouldn't matter if it's a different value temporarily
let key = "user-agent-suffix";
let key = "json-log-path";
// Save the old value, in case it's important. Probably not.
// If this doesn't work, pick a different setting to test with
let old_value = get(key).unwrap();
let new_value = "just a string that we're storing into some option for testing purposes";
let new_value = "/just/a/path/that/we/are/storing/into/some/option/for/testing/purposes";
let res_e = (|| {
set(key, new_value)?;