replace nixide::NixVerbosity with an export of nixide-sys::NixVerbosity
This commit is contained in:
parent
c6b9ffa81b
commit
20aefb99ed
1 changed files with 4 additions and 41 deletions
|
|
@ -1,46 +1,9 @@
|
|||
use crate::errors::ErrorContext;
|
||||
use crate::sys;
|
||||
use crate::util::wrap;
|
||||
use crate::util::wrappers::AsInnerPtr as _;
|
||||
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,
|
||||
Warn,
|
||||
Notice,
|
||||
Info,
|
||||
Talkative,
|
||||
Chatty,
|
||||
Debug,
|
||||
Vomit,
|
||||
}
|
||||
|
||||
impl From<sys::NixVerbosity> for NixVerbosity {
|
||||
fn from(level: sys::NixVerbosity) -> NixVerbosity {
|
||||
match level {
|
||||
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::NixVerbosity> for NixVerbosity {
|
||||
fn into(self) -> sys::NixVerbosity {
|
||||
self as sys::NixVerbosity
|
||||
}
|
||||
}
|
||||
pub use sys::NixVerbosity;
|
||||
|
||||
/// Sets the verbosity level.
|
||||
///
|
||||
|
|
@ -67,7 +30,7 @@ impl Into<sys::NixVerbosity> for NixVerbosity {
|
|||
///
|
||||
pub fn set_verbosity(level: NixVerbosity) {
|
||||
wrap::nix_fn!(|ctx: &ErrorContext| unsafe {
|
||||
sys::nix_set_verbosity(ctx.as_ptr(), level.into());
|
||||
sys::nix_set_verbosity(ctx.as_ptr(), level);
|
||||
})
|
||||
.unwrap_or_else(|err| panic_issue_call_failed!("{}", err))
|
||||
.unwrap()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue