update all names in repo to match new bindings

This commit is contained in:
do butterflies cry? 2026-04-02 09:53:36 +10:00
parent 54511d9c23
commit 25af468680
Signed by: cry
GPG key ID: F68745A836CA0412
29 changed files with 526 additions and 559 deletions

View file

@ -57,42 +57,29 @@ use crate::util::wrappers::AsInnerPtr;
/// };
/// ```
///
/// The [sys::nix_c_context] struct is laid out so that it can also be
/// cast to a [sys::nix_err] to inspect directly:
/// The [NixCContext] struct is laid out so that it can also be
/// cast to a [sys::NixErr] to inspect directly:
/// ```c
/// assert(*(nix_err*)ctx == NIX_OK);
/// ```
///
pub(crate) struct ErrorContext {
inner: NonNull<sys::nix_c_context>,
inner: NonNull<sys::NixCContext>,
}
// impl Clone for ErrorContext {
// fn clone(&self) -> Self {
// let inner = self.inner.clone();
//
// wrap::nix_fn!(|ctx: &ErrorContext| unsafe {
// sys::nix_gc_incref(ctx.as_ptr(), self.as_ptr() as *mut c_void);
// })
// .unwrap();
//
// Self { inner }
// }
// }
impl AsInnerPtr<sys::nix_c_context> for ErrorContext {
impl AsInnerPtr<sys::NixCContext> for ErrorContext {
#[inline]
unsafe fn as_ptr(&self) -> *mut sys::nix_c_context {
unsafe fn as_ptr(&self) -> *mut sys::NixCContext {
self.inner.as_ptr()
}
#[inline]
unsafe fn as_ref(&self) -> &sys::nix_c_context {
unsafe fn as_ref(&self) -> &sys::NixCContext {
unsafe { self.inner.as_ref() }
}
#[inline]
unsafe fn as_mut(&mut self) -> &mut sys::nix_c_context {
unsafe fn as_mut(&mut self) -> &mut sys::NixCContext {
unsafe { self.inner.as_mut() }
}
}
@ -100,11 +87,11 @@ impl AsInnerPtr<sys::nix_c_context> for ErrorContext {
impl Into<NixideResult<()>> for &ErrorContext {
/// # Panics
///
/// This function will panic in the event that `context.get_err() == Some(err) && err == sys::nix_err_NIX_OK`
/// since `nixide::ErrorContext::get_err` is expected to return `None` to indicate `sys::nix_err_NIX_OK`.
/// This function will panic in the event that `context.get_err() == Some(err) && err == sys::NixErr::NIX_OK`
/// since `nixide::ErrorContext::get_err` is expected to return `None` to indicate `sys::NixErr::NIX_OK`.
///
/// This function will panic in the event that `value != sys::nix_err_NIX_OK`
/// but that `context.get_code() == sys::nix_err_NIX_OK`
/// This function will panic in the event that `value != sys::NixErr::NIX_OK`
/// but that `context.get_code() == sys::NixErr::NIX_OK`
///
fn into(self) -> NixideResult<()> {
let inner = match self.get_err() {
@ -117,11 +104,11 @@ impl Into<NixideResult<()>> for &ErrorContext {
};
let err = match inner {
sys::nix_err_NIX_OK => unreachable!(),
sys::NixErr::Ok => unreachable!(),
sys::nix_err_NIX_ERR_OVERFLOW => NixError::Overflow,
sys::nix_err_NIX_ERR_KEY => NixError::KeyNotFound(None),
sys::nix_err_NIX_ERR_NIX_ERROR => NixError::ExprEval {
sys::NixErr::Overflow => NixError::Overflow,
sys::NixErr::Key => NixError::KeyNotFound(None),
sys::NixErr::NixError => NixError::ExprEval {
name: self
.get_nix_err_name()
.unwrap_or_else(|| panic_issue_call_failed!()),
@ -131,7 +118,7 @@ impl Into<NixideResult<()>> for &ErrorContext {
.unwrap_or_else(|| panic_issue_call_failed!()),
},
sys::nix_err_NIX_ERR_UNKNOWN => NixError::Unknown,
sys::NixErr::Unknown => NixError::Unknown,
err => NixError::Undocumented(err),
};
@ -145,13 +132,13 @@ impl ErrorContext {
/// # Errors
///
/// Returns an error if no memory can be allocated for
/// the underlying [sys::nix_c_context] struct.
/// the underlying [NixCContext] struct.
///
pub fn new() -> Self {
match NonNull::new(unsafe { sys::nix_c_context_create() }) {
Some(inner) => ErrorContext { inner },
None => panic!(
"[nixide] CRITICAL FAILURE: Out-Of-Memory condition reached - `sys::nix_c_context_create` allocation failed!"
"[nixide] CRITICAL FAILURE: Out-Of-Memory condition reached - `NixCContext_create` allocation failed!"
),
}
}
@ -216,12 +203,12 @@ impl ErrorContext {
Ok(())
}
/// Returns [None] if [self.code] is [sys::nix_err_NIX_OK], and [Some] otherwise.
/// Returns [None] if [self.code] is [sys::NixErr::NIX_OK], and [Some] otherwise.
///
/// # Nix C++ API Internals
///
/// ```cpp
/// nix_err nix_err_code(const nix_c_context * read_context)
/// nix_err nix_err::code(const nix_c_context * read_context)
/// {
/// return read_context->last_err_code;
/// }
@ -229,19 +216,19 @@ impl ErrorContext {
///
/// This function **never fails**.
///
fn get_err(&self) -> Option<sys::nix_err> {
fn get_err(&self) -> Option<sys::NixErr> {
match unsafe { sys::nix_err_code(self.as_ptr()) } {
sys::nix_err_NIX_OK => None,
sys::NixErr::Ok => None,
err => Some(err),
}
}
/// Returns [None] if [self.code] is [sys::nix_err_NIX_OK], and [Some] otherwise.
/// Returns [None] if [self.code] is [sys::NixErr::NIX_OK], and [Some] otherwise.
///
/// # Nix C++ API Internals
///
/// ```cpp
/// const char * nix_err_msg(nix_c_context * context, const nix_c_context * read_context, unsigned int * n)
/// const char * nix_err::msg(nix_c_context * context, const nix_c_context * read_context, unsigned int * n)
/// {
/// if (context)
/// context->last_err_code = NIX_OK;
@ -250,21 +237,21 @@ impl ErrorContext {
/// *n = read_context->last_err->size();
/// return read_context->last_err->c_str();
/// }
/// nix_set_err_msg(context, NIX_ERR_UNKNOWN, "No error message");
/// nix_set_err_msg(context, NIX_ERR::UNKNOWN, "No error message");
/// return nullptr;
/// }
/// ```
///
/// # Note
///
/// On failure [sys::nix_err_name] does the following if the error
/// has the error code [sys::nix_err_NIX_OK]:
/// On failure [sys::NixErr::name] does the following if the error
/// has the error code [sys::NixErr::NIX_OK]:
/// ```cpp
/// nix_set_err_msg(context, NIX_ERR_UNKNOWN, "No error message");
/// nix_set_err_msg(context, NIX_ERR::UNKNOWN, "No error message");
/// return nullptr;
/// ```
/// Hence we can just test whether the returned pointer is a `NULL` pointer,
/// and avoid passing in a [sys::nix_c_context] struct.
/// and avoid passing in a [NixCContext] struct.
///
fn get_msg(&self) -> Option<String> {
// NOTE: an Err here only occurs when `self.get_code() == Ok(())`
@ -281,13 +268,13 @@ impl ErrorContext {
}
}
/// Returns [None] if [self.code] is [sys::nix_err_NIX_OK], and [Some] otherwise.
/// Returns [None] if [self.code] is [sys::NixErr::NIX_OK], and [Some] otherwise.
///
/// # Nix C++ API Internals
///
/// ```cpp
/// // NOTE(nixide): the implementation of `nix_err_info_msg` is identical to `nix_err_name`
/// nix_err nix_err_info_msg(
/// // NOTE(nixide): the implementation of `nix_err::info_msg` is identical to `nix_err::name`
/// nix_err nix_err::info_msg(
/// nix_c_context * context,
/// const nix_c_context * read_context,
/// nix_get_string_callback callback,
@ -295,16 +282,16 @@ impl ErrorContext {
/// {
/// if (context)
/// context->last_err_code = NIX_OK;
/// if (read_context->last_err_code != NIX_ERR_NIX_ERROR) {
/// if (read_context->last_err_code != NIX_ERR::NIX_ERROR) {
/// // NOTE(nixide): `nix_set_err_msg` throws a `nix::Error` exception if `context == nullptr`
/// return nix_set_err_msg(context, NIX_ERR_UNKNOWN, "Last error was not a nix error");
/// return nix_set_err_msg(context, NIX_ERR::UNKNOWN, "Last error was not a nix error");
/// }
/// // NOTE(nixide): `call_nix_get_string_callback` always returns `NIX_OK`
/// return call_nix_get_string_callback(read_context->info->msg.str(), callback, user_data);
/// }
/// ```
///
/// `nix_err_info_msg` accepts two `nix_c_context*`:
/// `nix_err::info_msg` accepts two `nix_c_context*`:
/// * `nix_c_context* context` - errors from the function call are logged here
/// * `const nix_c_context* read_context` - the context to read `info_msg` from
///
@ -333,13 +320,13 @@ impl ErrorContext {
.ok()
}
/// Returns [None] if [self.code] is [sys::nix_err_NIX_OK], and [Some] otherwise.
/// Returns [None] if [self.code] is [sys::NixErr::NIX_OK], and [Some] otherwise.
///
/// # Nix C++ API Internals
///
/// ```cpp
/// // NOTE(nixide): the implementation of `nix_err_info_msg` is identical to `nix_err_name`
/// nix_err nix_err_info_msg(
/// // NOTE(nixide): the implementation of `nix_err::info_msg` is identical to `nix_err::name`
/// nix_err nix_err::info_msg(
/// nix_c_context * context,
/// const nix_c_context * read_context,
/// nix_get_string_callback callback,
@ -347,16 +334,16 @@ impl ErrorContext {
/// {
/// if (context)
/// context->last_err_code = NIX_OK;
/// if (read_context->last_err_code != NIX_ERR_NIX_ERROR) {
/// if (read_context->last_err_code != NIX_ERR::NIX_ERROR) {
/// // NOTE(nixide): `nix_set_err_msg` throws a `nix::Error` exception if `context == nullptr`
/// return nix_set_err_msg(context, NIX_ERR_UNKNOWN, "Last error was not a nix error");
/// return nix_set_err_msg(context, NIX_ERR::UNKNOWN, "Last error was not a nix error");
/// }
/// // NOTE(nixide): `call_nix_get_string_callback` always returns `NIX_OK`
/// return call_nix_get_string_callback(read_context->info->msg.str(), callback, user_data);
/// }
/// ```
///
/// `nix_err_info_msg` accepts two `nix_c_context*`:
/// `nix_err::info_msg` accepts two `nix_c_context*`:
/// * `nix_c_context* context` - errors from the function call are logged here
/// * `const nix_c_context* read_context` - the context to read `info_msg` from
///

View file

@ -12,7 +12,7 @@ pub enum NixideError {
/// that is instead mapped to [NixError::ExprEval]
NixError {
trace: String,
inner: sys::nix_err,
inner: sys::NixErr,
err: NixError,
msg: String,
},
@ -84,9 +84,7 @@ pub(crate) use new_nixide_error;
#[allow(unused_macros)]
macro_rules! retrace_nixide_error {
($x:expr) => {{
crate::errors::new_nixide_error!($x.err)
}};
($x:expr) => {{ crate::errors::new_nixide_error!($x.err) }};
}
pub(crate) use retrace_nixide_error;
@ -102,15 +100,15 @@ impl Display for NixideError {
msg,
} => {
write!(f, "[nixide ~ {trace}]{err} (nix_err={inner}): {msg}")
}
},
NixideError::StringNulByte { trace } => {
write!(f, "[nixide ~ {trace}] Got premature `\\0` (NUL) byte")
}
},
NixideError::StringNotUtf8 { trace } => {
write!(f, "[nixide ~ {trace}] Expected UTF-8 encoded string")
}
},
NixideError::NullPtr { trace } => write!(f, "[nixide ~ {trace}] Got null pointer"),
@ -123,7 +121,7 @@ impl Display for NixideError {
f,
"[nixide ~ {trace}] Invalid argument `{name}`: reason \"{reason}\""
)
}
},
NixideError::InvalidType {
trace,

View file

@ -93,15 +93,18 @@ pub enum NixError {
///
/// [NixError::Undocumented] has no equivalent in the `libnix` api.
/// This is solely a language difference between C++ and Rust, since
/// [sys::nix_err] is defined over the *"continuous" (not realy)*
/// [sys::NixErr] is defined over the *"continuous" (not realy)*
/// type [std::os::raw::c_int].
Undocumented(sys::nix_err),
Undocumented(sys::NixErr),
}
impl Display for NixError {
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
match self {
NixError::ExprEval { name, info_msg } => write!(f, "[libnix] NixExpr evaluation failed [name=\"{name}\", info_msg=\"{info_msg}\"]"),
NixError::ExprEval { name, info_msg } => write!(
f,
"[libnix] NixExpr evaluation failed [name=\"{name}\", info_msg=\"{info_msg}\"]"
),
NixError::KeyNotFound(Some(key)) => write!(f, "[libnix] Key not found \"{key}\""),
NixError::KeyNotFound(None) => write!(f, "[libnix] Key not found"),
NixError::Overflow => write!(f, "[libnix] Overflow error"),
@ -115,15 +118,15 @@ impl Display for NixError {
}
impl NixError {
pub fn err_code(&self) -> sys::nix_err {
pub fn err_code(&self) -> sys::NixErr {
match self {
NixError::Overflow => sys::nix_err_NIX_ERR_OVERFLOW,
NixError::KeyNotFound(_) => sys::nix_err_NIX_ERR_NIX_ERROR,
NixError::Overflow => sys::NixErr::Overflow,
NixError::KeyNotFound(_) => sys::NixErr::Key,
NixError::ExprEval {
name: _,
info_msg: _,
} => sys::nix_err_NIX_ERR_NIX_ERROR,
NixError::Unknown => sys::nix_err_NIX_ERR_UNKNOWN,
} => sys::NixErr::NixError,
NixError::Unknown => sys::NixErr::NixError,
NixError::Undocumented(err) => err.clone(),
}
}

View file

@ -18,23 +18,23 @@ use crate::util::{panic_issue_call_failed, wrap};
/// the evaluation state.
///
pub struct EvalStateBuilder {
inner: Rc<RefCell<NonNull<sys::nix_eval_state_builder>>>,
inner: Rc<RefCell<NonNull<sys::NixEvalStateBuilder>>>,
store: Rc<RefCell<Store>>,
}
impl AsInnerPtr<sys::nix_eval_state_builder> for EvalStateBuilder {
impl AsInnerPtr<sys::NixEvalStateBuilder> for EvalStateBuilder {
#[inline]
unsafe fn as_ptr(&self) -> *mut sys::nix_eval_state_builder {
unsafe fn as_ptr(&self) -> *mut sys::NixEvalStateBuilder {
self.inner.borrow().as_ptr()
}
#[inline]
unsafe fn as_ref(&self) -> &sys::nix_eval_state_builder {
unsafe fn as_ref(&self) -> &sys::NixEvalStateBuilder {
unsafe { self.inner.borrow().as_ref() }
}
#[inline]
unsafe fn as_mut(&mut self) -> &mut sys::nix_eval_state_builder {
unsafe fn as_mut(&mut self) -> &mut sys::NixEvalStateBuilder {
unsafe { self.inner.borrow_mut().as_mut() }
}
}

View file

@ -12,24 +12,24 @@ use crate::{EvalState, NixideResult, StorePath};
use crate::{Store, sys};
pub struct RealisedString<'a> {
inner: RefCell<NonNull<sys::nix_realised_string>>,
inner: RefCell<NonNull<sys::NixRealisedString>>,
pub path: StorePath,
pub children: LazyArray<StorePath, Box<dyn Fn(usize) -> StorePath + 'a>>,
}
impl<'a> AsInnerPtr<sys::nix_realised_string> for RealisedString<'a> {
impl<'a> AsInnerPtr<sys::NixRealisedString> for RealisedString<'a> {
#[inline]
unsafe fn as_ptr(&self) -> *mut sys::nix_realised_string {
unsafe fn as_ptr(&self) -> *mut sys::NixRealisedString {
self.inner.borrow().as_ptr()
}
#[inline]
unsafe fn as_ref(&self) -> &sys::nix_realised_string {
unsafe fn as_ref(&self) -> &sys::NixRealisedString {
unsafe { self.inner.borrow().as_ref() }
}
#[inline]
unsafe fn as_mut(&mut self) -> &mut sys::nix_realised_string {
unsafe fn as_mut(&mut self) -> &mut sys::NixRealisedString {
unsafe { self.inner.borrow_mut().as_mut() }
}
}
@ -82,7 +82,7 @@ impl<'a> RealisedString<'a> {
})
}
fn parse_path(realised_string: *mut sys::nix_realised_string, store: &Store) -> StorePath {
fn parse_path(realised_string: *mut sys::NixRealisedString, store: &Store) -> StorePath {
let buffer_ptr = unsafe { sys::nix_realised_string_get_buffer_start(realised_string) };
let buffer_size = unsafe { sys::nix_realised_string_get_buffer_size(realised_string) };

View file

@ -12,7 +12,7 @@ use crate::util::wrappers::AsInnerPtr;
use crate::util::{panic_issue_call_failed, wrap};
pub struct NixAttrs {
inner: NonNull<sys::nix_value>,
inner: NonNull<sys::NixValue>,
state: Rc<RefCell<NonNull<sys::EvalState>>>,
len: u32,
}
@ -55,19 +55,19 @@ impl Debug for NixAttrs {
}
}
impl AsInnerPtr<sys::nix_value> for NixAttrs {
impl AsInnerPtr<sys::NixValue> for NixAttrs {
#[inline]
unsafe fn as_ptr(&self) -> *mut sys::nix_value {
unsafe fn as_ptr(&self) -> *mut sys::NixValue {
self.inner.as_ptr()
}
#[inline]
unsafe fn as_ref(&self) -> &sys::nix_value {
unsafe fn as_ref(&self) -> &sys::NixValue {
unsafe { self.inner.as_ref() }
}
#[inline]
unsafe fn as_mut(&mut self) -> &mut sys::nix_value {
unsafe fn as_mut(&mut self) -> &mut sys::NixValue {
unsafe { self.inner.as_mut() }
}
}
@ -75,10 +75,10 @@ impl AsInnerPtr<sys::nix_value> for NixAttrs {
impl NixValue for NixAttrs {
#[inline]
fn type_id(&self) -> sys::ValueType {
sys::ValueType_NIX_TYPE_ATTRS
sys::ValueType::Attrs
}
fn from(inner: NonNull<sys::nix_value>, state: Rc<RefCell<NonNull<sys::EvalState>>>) -> Self {
fn from(inner: NonNull<sys::NixValue>, state: Rc<RefCell<NonNull<sys::EvalState>>>) -> Self {
let len = wrap::nix_fn!(|ctx: &ErrorContext| unsafe {
sys::nix_get_attrs_size(ctx.as_ptr(), inner.as_ptr())
})

View file

@ -11,7 +11,7 @@ use crate::util::wrap;
use crate::util::wrappers::AsInnerPtr;
pub struct NixBool {
inner: NonNull<sys::nix_value>,
inner: NonNull<sys::NixValue>,
state: Rc<RefCell<NonNull<sys::EvalState>>>,
value: bool,
}
@ -54,19 +54,19 @@ impl Debug for NixBool {
}
}
impl AsInnerPtr<sys::nix_value> for NixBool {
impl AsInnerPtr<sys::NixValue> for NixBool {
#[inline]
unsafe fn as_ptr(&self) -> *mut sys::nix_value {
unsafe fn as_ptr(&self) -> *mut sys::NixValue {
self.inner.as_ptr()
}
#[inline]
unsafe fn as_ref(&self) -> &sys::nix_value {
unsafe fn as_ref(&self) -> &sys::NixValue {
unsafe { self.inner.as_ref() }
}
#[inline]
unsafe fn as_mut(&mut self) -> &mut sys::nix_value {
unsafe fn as_mut(&mut self) -> &mut sys::NixValue {
unsafe { self.inner.as_mut() }
}
}
@ -74,10 +74,10 @@ impl AsInnerPtr<sys::nix_value> for NixBool {
impl NixValue for NixBool {
#[inline]
fn type_id(&self) -> sys::ValueType {
sys::ValueType_NIX_TYPE_BOOL
sys::ValueType::Bool
}
fn from(inner: NonNull<sys::nix_value>, state: Rc<RefCell<NonNull<sys::EvalState>>>) -> Self {
fn from(inner: NonNull<sys::NixValue>, state: Rc<RefCell<NonNull<sys::EvalState>>>) -> Self {
let value = wrap::nix_fn!(|ctx: &ErrorContext| unsafe {
sys::nix_get_bool(ctx.as_ptr(), inner.as_ptr())
})

View file

@ -10,7 +10,7 @@ use crate::util::wrappers::AsInnerPtr;
use crate::util::{panic_issue_call_failed, wrap};
pub struct NixFloat {
inner: NonNull<sys::nix_value>,
inner: NonNull<sys::NixValue>,
state: Rc<RefCell<NonNull<sys::EvalState>>>,
value: f64,
}
@ -53,19 +53,19 @@ impl Debug for NixFloat {
}
}
impl AsInnerPtr<sys::nix_value> for NixFloat {
impl AsInnerPtr<sys::NixValue> for NixFloat {
#[inline]
unsafe fn as_ptr(&self) -> *mut sys::nix_value {
unsafe fn as_ptr(&self) -> *mut sys::NixValue {
self.inner.as_ptr()
}
#[inline]
unsafe fn as_ref(&self) -> &sys::nix_value {
unsafe fn as_ref(&self) -> &sys::NixValue {
unsafe { self.inner.as_ref() }
}
#[inline]
unsafe fn as_mut(&mut self) -> &mut sys::nix_value {
unsafe fn as_mut(&mut self) -> &mut sys::NixValue {
unsafe { self.inner.as_mut() }
}
}
@ -73,10 +73,10 @@ impl AsInnerPtr<sys::nix_value> for NixFloat {
impl NixValue for NixFloat {
#[inline]
fn type_id(&self) -> sys::ValueType {
sys::ValueType_NIX_TYPE_FLOAT
sys::ValueType::Float
}
fn from(inner: NonNull<sys::nix_value>, state: Rc<RefCell<NonNull<sys::EvalState>>>) -> Self {
fn from(inner: NonNull<sys::NixValue>, state: Rc<RefCell<NonNull<sys::EvalState>>>) -> Self {
let value = wrap::nix_fn!(|ctx: &ErrorContext| unsafe {
sys::nix_get_float(ctx.as_ptr(), inner.as_ptr())
})

View file

@ -11,7 +11,7 @@ use crate::util::wrappers::AsInnerPtr;
use crate::util::{panic_issue_call_failed, wrap};
pub struct NixFunction {
inner: NonNull<sys::nix_value>,
inner: NonNull<sys::NixValue>,
state: Rc<RefCell<NonNull<sys::EvalState>>>,
}
@ -52,19 +52,19 @@ impl Debug for NixFunction {
}
}
impl AsInnerPtr<sys::nix_value> for NixFunction {
impl AsInnerPtr<sys::NixValue> for NixFunction {
#[inline]
unsafe fn as_ptr(&self) -> *mut sys::nix_value {
unsafe fn as_ptr(&self) -> *mut sys::NixValue {
self.inner.as_ptr()
}
#[inline]
unsafe fn as_ref(&self) -> &sys::nix_value {
unsafe fn as_ref(&self) -> &sys::NixValue {
unsafe { self.inner.as_ref() }
}
#[inline]
unsafe fn as_mut(&mut self) -> &mut sys::nix_value {
unsafe fn as_mut(&mut self) -> &mut sys::NixValue {
unsafe { self.inner.as_mut() }
}
}
@ -72,10 +72,10 @@ impl AsInnerPtr<sys::nix_value> for NixFunction {
impl NixValue for NixFunction {
#[inline]
fn type_id(&self) -> sys::ValueType {
sys::ValueType_NIX_TYPE_FUNCTION
sys::ValueType::Function
}
fn from(inner: NonNull<sys::nix_value>, state: Rc<RefCell<NonNull<sys::EvalState>>>) -> Self {
fn from(inner: NonNull<sys::NixValue>, state: Rc<RefCell<NonNull<sys::EvalState>>>) -> Self {
Self { inner, state }
}
}

View file

@ -10,7 +10,7 @@ use crate::util::wrappers::AsInnerPtr;
use crate::util::{panic_issue_call_failed, wrap};
pub struct NixInt {
inner: NonNull<sys::nix_value>,
inner: NonNull<sys::NixValue>,
state: Rc<RefCell<NonNull<sys::EvalState>>>,
value: i64,
}
@ -53,19 +53,19 @@ impl Debug for NixInt {
}
}
impl AsInnerPtr<sys::nix_value> for NixInt {
impl AsInnerPtr<sys::NixValue> for NixInt {
#[inline]
unsafe fn as_ptr(&self) -> *mut sys::nix_value {
unsafe fn as_ptr(&self) -> *mut sys::NixValue {
self.inner.as_ptr()
}
#[inline]
unsafe fn as_ref(&self) -> &sys::nix_value {
unsafe fn as_ref(&self) -> &sys::NixValue {
unsafe { self.inner.as_ref() }
}
#[inline]
unsafe fn as_mut(&mut self) -> &mut sys::nix_value {
unsafe fn as_mut(&mut self) -> &mut sys::NixValue {
unsafe { self.inner.as_mut() }
}
}
@ -73,10 +73,10 @@ impl AsInnerPtr<sys::nix_value> for NixInt {
impl NixValue for NixInt {
#[inline]
fn type_id(&self) -> sys::ValueType {
sys::ValueType_NIX_TYPE_INT
sys::ValueType::Int
}
fn from(inner: NonNull<sys::nix_value>, state: Rc<RefCell<NonNull<sys::EvalState>>>) -> Self {
fn from(inner: NonNull<sys::NixValue>, state: Rc<RefCell<NonNull<sys::EvalState>>>) -> Self {
let value = wrap::nix_fn!(|ctx: &ErrorContext| unsafe {
sys::nix_get_int(ctx.as_ptr(), inner.as_ptr())
})

View file

@ -10,7 +10,7 @@ use crate::util::wrappers::AsInnerPtr;
use crate::util::{panic_issue_call_failed, wrap};
pub struct NixList {
inner: NonNull<sys::nix_value>,
inner: NonNull<sys::NixValue>,
state: Rc<RefCell<NonNull<sys::EvalState>>>,
}
@ -51,19 +51,19 @@ impl Debug for NixList {
}
}
impl AsInnerPtr<sys::nix_value> for NixList {
impl AsInnerPtr<sys::NixValue> for NixList {
#[inline]
unsafe fn as_ptr(&self) -> *mut sys::nix_value {
unsafe fn as_ptr(&self) -> *mut sys::NixValue {
self.inner.as_ptr()
}
#[inline]
unsafe fn as_ref(&self) -> &sys::nix_value {
unsafe fn as_ref(&self) -> &sys::NixValue {
unsafe { self.inner.as_ref() }
}
#[inline]
unsafe fn as_mut(&mut self) -> &mut sys::nix_value {
unsafe fn as_mut(&mut self) -> &mut sys::NixValue {
unsafe { self.inner.as_mut() }
}
}
@ -71,10 +71,10 @@ impl AsInnerPtr<sys::nix_value> for NixList {
impl NixValue for NixList {
#[inline]
fn type_id(&self) -> sys::ValueType {
sys::ValueType_NIX_TYPE_LIST
sys::ValueType::List
}
fn from(inner: NonNull<sys::nix_value>, state: Rc<RefCell<NonNull<sys::EvalState>>>) -> Self {
fn from(inner: NonNull<sys::NixValue>, state: Rc<RefCell<NonNull<sys::EvalState>>>) -> Self {
Self { inner, state }
}
}

View file

@ -30,21 +30,16 @@ use std::rc::Rc;
use crate::errors::ErrorContext;
use crate::sys;
use crate::sys::{
ValueType_NIX_TYPE_ATTRS, ValueType_NIX_TYPE_BOOL, ValueType_NIX_TYPE_EXTERNAL,
ValueType_NIX_TYPE_FLOAT, ValueType_NIX_TYPE_FUNCTION, ValueType_NIX_TYPE_INT,
ValueType_NIX_TYPE_LIST, ValueType_NIX_TYPE_NULL, ValueType_NIX_TYPE_PATH,
ValueType_NIX_TYPE_STRING, ValueType_NIX_TYPE_THUNK,
};
use crate::sys::ValueType;
use crate::util::wrappers::AsInnerPtr;
use crate::util::{panic_issue_call_failed, wrap};
pub trait NixValue: Clone + Drop + Display + Debug + AsInnerPtr<sys::nix_value> {
pub trait NixValue: Clone + Drop + Display + Debug + AsInnerPtr<sys::NixValue> {
/// TODO
fn type_id(&self) -> sys::ValueType;
/// TODO
fn from(inner: NonNull<sys::nix_value>, state: Rc<RefCell<NonNull<sys::EvalState>>>) -> Self;
fn from(inner: NonNull<sys::NixValue>, state: Rc<RefCell<NonNull<sys::EvalState>>>) -> Self;
}
/// A Nix value
@ -110,18 +105,8 @@ pub enum Value {
// Failed(NixFailed),
}
impl
From<(
NonNull<sys::nix_value>,
Rc<RefCell<NonNull<sys::EvalState>>>,
)> for Value
{
fn from(
value: (
NonNull<sys::nix_value>,
Rc<RefCell<NonNull<sys::EvalState>>>,
),
) -> Self {
impl From<(NonNull<sys::NixValue>, Rc<RefCell<NonNull<sys::EvalState>>>)> for Value {
fn from(value: (NonNull<sys::NixValue>, Rc<RefCell<NonNull<sys::EvalState>>>)) -> Self {
let (inner, state) = value;
wrap::nix_fn!(|ctx: &ErrorContext| unsafe {
@ -136,22 +121,20 @@ impl
#[allow(non_upper_case_globals)]
match type_id {
ValueType_NIX_TYPE_THUNK => Value::Thunk(<NixThunk as NixValue>::from(inner, state)),
ValueType_NIX_TYPE_INT => Value::Int(<NixInt as NixValue>::from(inner, state)),
ValueType_NIX_TYPE_FLOAT => Value::Float(<NixFloat as NixValue>::from(inner, state)),
ValueType_NIX_TYPE_BOOL => Value::Bool(<NixBool as NixValue>::from(inner, state)),
ValueType_NIX_TYPE_STRING => Value::String(<NixString as NixValue>::from(inner, state)),
ValueType_NIX_TYPE_PATH => Value::Path(<NixPath as NixValue>::from(inner, state)),
ValueType_NIX_TYPE_NULL => Value::Null(<NixNull as NixValue>::from(inner, state)),
ValueType_NIX_TYPE_ATTRS => Value::Attrs(<NixAttrs as NixValue>::from(inner, state)),
ValueType_NIX_TYPE_LIST => Value::List(<NixList as NixValue>::from(inner, state)),
ValueType_NIX_TYPE_FUNCTION => {
Value::Function(<NixFunction as NixValue>::from(inner, state))
},
// ValueType_NIX_TYPE_EXTERNAL => {
ValueType::Thunk => Value::Thunk(<NixThunk as NixValue>::from(inner, state)),
ValueType::Int => Value::Int(<NixInt as NixValue>::from(inner, state)),
ValueType::Float => Value::Float(<NixFloat as NixValue>::from(inner, state)),
ValueType::Bool => Value::Bool(<NixBool as NixValue>::from(inner, state)),
ValueType::String => Value::String(<NixString as NixValue>::from(inner, state)),
ValueType::Path => Value::Path(<NixPath as NixValue>::from(inner, state)),
ValueType::Null => Value::Null(<NixNull as NixValue>::from(inner, state)),
ValueType::Attrs => Value::Attrs(<NixAttrs as NixValue>::from(inner, state)),
ValueType::List => Value::List(<NixList as NixValue>::from(inner, state)),
ValueType::Function => Value::Function(<NixFunction as NixValue>::from(inner, state)),
// ValueType::External => {
// Value::External(<NixExternal as NixValue>::from(inner, state))
// },
// ValueType_NIX_TYPE_FAILED => {
// ValueType::Failed => {
// Value::Failed(<NixFailed as NixValue>::from(inner, state))
// },
_ => unreachable!(),

View file

@ -10,7 +10,7 @@ use crate::util::wrap;
use crate::util::wrappers::AsInnerPtr;
pub struct NixNull {
inner: NonNull<sys::nix_value>,
inner: NonNull<sys::NixValue>,
state: Rc<RefCell<NonNull<sys::EvalState>>>,
}
@ -51,19 +51,19 @@ impl Debug for NixNull {
}
}
impl AsInnerPtr<sys::nix_value> for NixNull {
impl AsInnerPtr<sys::NixValue> for NixNull {
#[inline]
unsafe fn as_ptr(&self) -> *mut sys::nix_value {
unsafe fn as_ptr(&self) -> *mut sys::NixValue {
self.inner.as_ptr()
}
#[inline]
unsafe fn as_ref(&self) -> &sys::nix_value {
unsafe fn as_ref(&self) -> &sys::NixValue {
unsafe { self.inner.as_ref() }
}
#[inline]
unsafe fn as_mut(&mut self) -> &mut sys::nix_value {
unsafe fn as_mut(&mut self) -> &mut sys::NixValue {
unsafe { self.inner.as_mut() }
}
}
@ -71,10 +71,10 @@ impl AsInnerPtr<sys::nix_value> for NixNull {
impl NixValue for NixNull {
#[inline]
fn type_id(&self) -> sys::ValueType {
sys::ValueType_NIX_TYPE_NULL
sys::ValueType::Null
}
fn from(inner: NonNull<sys::nix_value>, state: Rc<RefCell<NonNull<sys::EvalState>>>) -> Self {
fn from(inner: NonNull<sys::NixValue>, state: Rc<RefCell<NonNull<sys::EvalState>>>) -> Self {
Self { inner, state }
}
}

View file

@ -13,7 +13,7 @@ use crate::util::wrap;
use crate::util::wrappers::AsInnerPtr;
pub struct NixPath {
inner: NonNull<sys::nix_value>,
inner: NonNull<sys::NixValue>,
state: Rc<RefCell<NonNull<sys::EvalState>>>,
value: PathBuf,
}
@ -56,19 +56,19 @@ impl Debug for NixPath {
}
}
impl AsInnerPtr<sys::nix_value> for NixPath {
impl AsInnerPtr<sys::NixValue> for NixPath {
#[inline]
unsafe fn as_ptr(&self) -> *mut sys::nix_value {
unsafe fn as_ptr(&self) -> *mut sys::NixValue {
self.inner.as_ptr()
}
#[inline]
unsafe fn as_ref(&self) -> &sys::nix_value {
unsafe fn as_ref(&self) -> &sys::NixValue {
unsafe { self.inner.as_ref() }
}
#[inline]
unsafe fn as_mut(&mut self) -> &mut sys::nix_value {
unsafe fn as_mut(&mut self) -> &mut sys::NixValue {
unsafe { self.inner.as_mut() }
}
}
@ -76,10 +76,10 @@ impl AsInnerPtr<sys::nix_value> for NixPath {
impl NixValue for NixPath {
#[inline]
fn type_id(&self) -> sys::ValueType {
sys::ValueType_NIX_TYPE_PATH
sys::ValueType::Path
}
fn from(inner: NonNull<sys::nix_value>, state: Rc<RefCell<NonNull<sys::EvalState>>>) -> Self {
fn from(inner: NonNull<sys::NixValue>, state: Rc<RefCell<NonNull<sys::EvalState>>>) -> Self {
let value = wrap::nix_fn!(|ctx: &ErrorContext| unsafe {
sys::nix_get_path_string(ctx.as_ptr(), inner.as_ptr())
})

View file

@ -12,7 +12,7 @@ use crate::util::wrap;
use crate::util::wrappers::AsInnerPtr;
pub struct NixString {
inner: NonNull<sys::nix_value>,
inner: NonNull<sys::NixValue>,
state: Rc<RefCell<NonNull<sys::EvalState>>>,
value: String,
}
@ -55,19 +55,19 @@ impl Debug for NixString {
}
}
impl AsInnerPtr<sys::nix_value> for NixString {
impl AsInnerPtr<sys::NixValue> for NixString {
#[inline]
unsafe fn as_ptr(&self) -> *mut sys::nix_value {
unsafe fn as_ptr(&self) -> *mut sys::NixValue {
self.inner.as_ptr()
}
#[inline]
unsafe fn as_ref(&self) -> &sys::nix_value {
unsafe fn as_ref(&self) -> &sys::NixValue {
unsafe { self.inner.as_ref() }
}
#[inline]
unsafe fn as_mut(&mut self) -> &mut sys::nix_value {
unsafe fn as_mut(&mut self) -> &mut sys::NixValue {
unsafe { self.inner.as_mut() }
}
}
@ -75,10 +75,10 @@ impl AsInnerPtr<sys::nix_value> for NixString {
impl NixValue for NixString {
#[inline]
fn type_id(&self) -> sys::ValueType {
sys::ValueType_NIX_TYPE_STRING
sys::ValueType::String
}
fn from(inner: NonNull<sys::nix_value>, state: Rc<RefCell<NonNull<sys::EvalState>>>) -> Self {
fn from(inner: NonNull<sys::NixValue>, state: Rc<RefCell<NonNull<sys::EvalState>>>) -> Self {
let value = wrap::nix_string_callback!(
|callback, userdata: *mut __UserData, ctx: &ErrorContext| unsafe {
sys::nix_get_string(

View file

@ -10,7 +10,7 @@ use crate::util::wrappers::AsInnerPtr;
use crate::util::{panic_issue_call_failed, wrap};
pub struct NixThunk {
inner: NonNull<sys::nix_value>,
inner: NonNull<sys::NixValue>,
state: Rc<RefCell<NonNull<sys::EvalState>>>,
}
@ -51,19 +51,19 @@ impl Debug for NixThunk {
}
}
impl AsInnerPtr<sys::nix_value> for NixThunk {
impl AsInnerPtr<sys::NixValue> for NixThunk {
#[inline]
unsafe fn as_ptr(&self) -> *mut sys::nix_value {
unsafe fn as_ptr(&self) -> *mut sys::NixValue {
self.inner.as_ptr()
}
#[inline]
unsafe fn as_ref(&self) -> &sys::nix_value {
unsafe fn as_ref(&self) -> &sys::NixValue {
unsafe { self.inner.as_ref() }
}
#[inline]
unsafe fn as_mut(&mut self) -> &mut sys::nix_value {
unsafe fn as_mut(&mut self) -> &mut sys::NixValue {
unsafe { self.inner.as_mut() }
}
}
@ -71,10 +71,10 @@ impl AsInnerPtr<sys::nix_value> for NixThunk {
impl NixValue for NixThunk {
#[inline]
fn type_id(&self) -> sys::ValueType {
sys::ValueType_NIX_TYPE_THUNK
sys::ValueType::Thunk
}
fn from(inner: NonNull<sys::nix_value>, state: Rc<RefCell<NonNull<sys::EvalState>>>) -> Self {
fn from(inner: NonNull<sys::NixValue>, state: Rc<RefCell<NonNull<sys::EvalState>>>) -> Self {
Self { inner, state }
}
}

View file

@ -7,7 +7,7 @@ use crate::util::wrap;
use crate::util::wrappers::AsInnerPtr;
pub struct FetchersSettings {
inner: NonNull<sys::nix_fetchers_settings>,
inner: NonNull<sys::NixFetchersSettings>,
}
impl FetchersSettings {
@ -41,19 +41,19 @@ impl Drop for FetchersSettings {
}
}
impl AsInnerPtr<sys::nix_fetchers_settings> for FetchersSettings {
impl AsInnerPtr<sys::NixFetchersSettings> for FetchersSettings {
#[inline]
unsafe fn as_ptr(&self) -> *mut sys::nix_fetchers_settings {
unsafe fn as_ptr(&self) -> *mut sys::NixFetchersSettings {
self.inner.as_ptr()
}
#[inline]
unsafe fn as_ref(&self) -> &sys::nix_fetchers_settings {
unsafe fn as_ref(&self) -> &sys::NixFetchersSettings {
unsafe { self.inner.as_ref() }
}
#[inline]
unsafe fn as_mut(&mut self) -> &mut sys::nix_fetchers_settings {
unsafe fn as_mut(&mut self) -> &mut sys::NixFetchersSettings {
unsafe { self.inner.as_mut() }
}
}

View file

@ -1,4 +1,3 @@
use std::ffi::c_void;
use std::ptr::NonNull;
use super::{FlakeReference, FlakeSettings};
@ -26,7 +25,7 @@ pub enum FlakeLockMode {
/// Parameters that affect the locking of a flake.
pub struct FlakeLockFlags {
pub(crate) inner: NonNull<sys::nix_flake_lock_flags>,
pub(crate) inner: NonNull<sys::NixFlakeLockFlags>,
}
// impl Clone for FlakeLockFlags {
@ -50,19 +49,19 @@ impl Drop for FlakeLockFlags {
}
}
impl AsInnerPtr<sys::nix_flake_lock_flags> for FlakeLockFlags {
impl AsInnerPtr<sys::NixFlakeLockFlags> for FlakeLockFlags {
#[inline]
unsafe fn as_ptr(&self) -> *mut sys::nix_flake_lock_flags {
unsafe fn as_ptr(&self) -> *mut sys::NixFlakeLockFlags {
self.inner.as_ptr()
}
#[inline]
unsafe fn as_ref(&self) -> &sys::nix_flake_lock_flags {
unsafe fn as_ref(&self) -> &sys::NixFlakeLockFlags {
unsafe { self.inner.as_ref() }
}
#[inline]
unsafe fn as_mut(&mut self) -> &mut sys::nix_flake_lock_flags {
unsafe fn as_mut(&mut self) -> &mut sys::NixFlakeLockFlags {
unsafe { self.inner.as_mut() }
}
}

View file

@ -11,7 +11,7 @@ use crate::util::wrappers::AsInnerPtr;
// XXX: TODO: rename FlakeReference -> FlakeRef
pub struct FlakeReference {
inner: NonNull<sys::nix_flake_reference>,
inner: NonNull<sys::NixFlakeReference>,
fragment: String,
}
@ -37,19 +37,19 @@ impl Drop for FlakeReference {
}
}
impl AsInnerPtr<sys::nix_flake_reference> for FlakeReference {
impl AsInnerPtr<sys::NixFlakeReference> for FlakeReference {
#[inline]
unsafe fn as_ptr(&self) -> *mut sys::nix_flake_reference {
unsafe fn as_ptr(&self) -> *mut sys::NixFlakeReference {
self.inner.as_ptr()
}
#[inline]
unsafe fn as_ref(&self) -> &sys::nix_flake_reference {
unsafe fn as_ref(&self) -> &sys::NixFlakeReference {
unsafe { self.inner.as_ref() }
}
#[inline]
unsafe fn as_mut(&mut self) -> &mut sys::nix_flake_reference {
unsafe fn as_mut(&mut self) -> &mut sys::NixFlakeReference {
unsafe { self.inner.as_mut() }
}
}
@ -65,7 +65,7 @@ impl FlakeReference {
flags: &FlakeReferenceParseFlags,
reference: &str,
) -> Result<FlakeReference, NixideError> {
let mut ptr: *mut sys::nix_flake_reference = null_mut();
let mut ptr: *mut sys::NixFlakeReference = null_mut();
let fragment = wrap::nix_string_callback!(
|callback, userdata: *mut __UserData, ctx: &ErrorContext| unsafe {
sys::nix_flake_reference_and_fragment_from_string(

View file

@ -1,4 +1,3 @@
use std::ffi::c_void;
use std::os::raw::c_char;
use std::ptr::NonNull;
@ -12,7 +11,7 @@ use crate::util::wrappers::AsInnerPtr;
/// Parameters for parsing a flake reference.
#[derive(Debug)]
pub struct FlakeReferenceParseFlags {
inner: NonNull<sys::nix_flake_reference_parse_flags>,
inner: NonNull<sys::NixFlakeReferenceParseFlags>,
}
// impl Clone for FlakeReferenceParseFlags {
@ -36,19 +35,19 @@ impl Drop for FlakeReferenceParseFlags {
}
}
impl AsInnerPtr<sys::nix_flake_reference_parse_flags> for FlakeReferenceParseFlags {
impl AsInnerPtr<sys::NixFlakeReferenceParseFlags> for FlakeReferenceParseFlags {
#[inline]
unsafe fn as_ptr(&self) -> *mut sys::nix_flake_reference_parse_flags {
unsafe fn as_ptr(&self) -> *mut sys::NixFlakeReferenceParseFlags {
self.inner.as_ptr()
}
#[inline]
unsafe fn as_ref(&self) -> &sys::nix_flake_reference_parse_flags {
unsafe fn as_ref(&self) -> &sys::NixFlakeReferenceParseFlags {
unsafe { self.inner.as_ref() }
}
#[inline]
unsafe fn as_mut(&mut self) -> &mut sys::nix_flake_reference_parse_flags {
unsafe fn as_mut(&mut self) -> &mut sys::NixFlakeReferenceParseFlags {
unsafe { self.inner.as_mut() }
}
}

View file

@ -8,7 +8,7 @@ use crate::util::wrappers::AsInnerPtr;
/// Store settings for the flakes feature.
pub struct FlakeSettings {
inner: NonNull<sys::nix_flake_settings>,
inner: NonNull<sys::NixFlakeSettings>,
}
impl Drop for FlakeSettings {
@ -19,19 +19,19 @@ impl Drop for FlakeSettings {
}
}
impl AsInnerPtr<sys::nix_flake_settings> for FlakeSettings {
impl AsInnerPtr<sys::NixFlakeSettings> for FlakeSettings {
#[inline]
unsafe fn as_ptr(&self) -> *mut sys::nix_flake_settings {
unsafe fn as_ptr(&self) -> *mut sys::NixFlakeSettings {
self.inner.as_ptr()
}
#[inline]
unsafe fn as_ref(&self) -> &sys::nix_flake_settings {
unsafe fn as_ref(&self) -> &sys::NixFlakeSettings {
unsafe { self.inner.as_ref() }
}
#[inline]
unsafe fn as_mut(&mut self) -> &mut sys::nix_flake_settings {
unsafe fn as_mut(&mut self) -> &mut sys::NixFlakeSettings {
unsafe { self.inner.as_mut() }
}
}

View file

@ -10,7 +10,7 @@ use crate::util::wrappers::AsInnerPtr;
use crate::{EvalState, NixideResult, Value};
pub struct LockedFlake {
inner: NonNull<sys::nix_locked_flake>,
inner: NonNull<sys::NixLockedFlake>,
flakeref: FlakeReference,
state: EvalState,
@ -45,19 +45,19 @@ impl Drop for LockedFlake {
}
}
impl AsInnerPtr<sys::nix_locked_flake> for LockedFlake {
impl AsInnerPtr<sys::NixLockedFlake> for LockedFlake {
#[inline]
unsafe fn as_ptr(&self) -> *mut sys::nix_locked_flake {
unsafe fn as_ptr(&self) -> *mut sys::NixLockedFlake {
self.inner.as_ptr()
}
#[inline]
unsafe fn as_ref(&self) -> &sys::nix_locked_flake {
unsafe fn as_ref(&self) -> &sys::NixLockedFlake {
unsafe { self.inner.as_ref() }
}
#[inline]
unsafe fn as_mut(&mut self) -> &mut sys::nix_locked_flake {
unsafe fn as_mut(&mut self) -> &mut sys::NixLockedFlake {
unsafe { self.inner.as_mut() }
}
}

View file

@ -1,13 +1,14 @@
use crate::errors::ErrorContext;
use crate::sys;
use crate::util::wrappers::AsInnerPtr as _;
use crate::util::{panic_issue, panic_issue_call_failed, wrap};
use crate::util::{panic_issue_call_failed, wrap};
/// Verbosity level
///
/// # NOTE
///
/// This should be kept in sync with the C++ implementation (nix::Verbosity)
///
#[derive(Debug, Clone, Copy)]
pub enum NixVerbosity {
Error,
@ -20,28 +21,24 @@ pub enum NixVerbosity {
Vomit,
}
impl From<sys::nix_verbosity> for NixVerbosity {
fn from(level: sys::nix_verbosity) -> NixVerbosity {
impl From<sys::NixVerbosity> for NixVerbosity {
fn from(level: sys::NixVerbosity) -> NixVerbosity {
match level {
sys::nix_verbosity_NIX_LVL_ERROR => NixVerbosity::Error,
sys::nix_verbosity_NIX_LVL_WARN => NixVerbosity::Warn,
sys::nix_verbosity_NIX_LVL_NOTICE => NixVerbosity::Notice,
sys::nix_verbosity_NIX_LVL_INFO => NixVerbosity::Info,
sys::nix_verbosity_NIX_LVL_TALKATIVE => NixVerbosity::Talkative,
sys::nix_verbosity_NIX_LVL_CHATTY => NixVerbosity::Chatty,
sys::nix_verbosity_NIX_LVL_DEBUG => NixVerbosity::Debug,
sys::nix_verbosity_NIX_LVL_VOMIT => NixVerbosity::Vomit,
value => panic_issue!(
"nixide encountered unknown `nix_verbosity` value ({})",
value
),
sys::NixVerbosity::Error => NixVerbosity::Error,
sys::NixVerbosity::Warn => NixVerbosity::Warn,
sys::NixVerbosity::Notice => NixVerbosity::Notice,
sys::NixVerbosity::Info => NixVerbosity::Info,
sys::NixVerbosity::Talkative => NixVerbosity::Talkative,
sys::NixVerbosity::Chatty => NixVerbosity::Chatty,
sys::NixVerbosity::Debug => NixVerbosity::Debug,
sys::NixVerbosity::Vomit => NixVerbosity::Vomit,
}
}
}
impl Into<sys::nix_verbosity> for NixVerbosity {
fn into(self) -> sys::nix_verbosity {
self as sys::nix_verbosity
impl Into<sys::NixVerbosity> for NixVerbosity {
fn into(self) -> sys::NixVerbosity {
self as sys::NixVerbosity
}
}