feat: Context.is_key_error

(cherry picked from commit f754e243852103164dbc6fdaf8c0cccb3c85cfb1)
This commit is contained in:
Robert Hensing 2024-04-10 14:24:01 +02:00
parent 49576f82e4
commit d38cf51c63

View file

@ -34,6 +34,10 @@ impl Context {
}
Ok(())
}
/// NIX_ERR_KEY is returned when e.g. an attribute is missing. Return true if the error is of this type.
pub fn is_key_error(&self) -> bool {
unsafe { raw::err_code(self.inner.as_ptr()) == raw::NIX_ERR_KEY }
}
}
impl Drop for Context {