diff --git a/nixide/src/store/mod.rs b/nixide/src/store/mod.rs index 4bca2a8..63f347c 100644 --- a/nixide/src/store/mod.rs +++ b/nixide/src/store/mod.rs @@ -23,10 +23,10 @@ use std::result::Result; use crate::errors::{new_nixide_error, ErrorContext}; use crate::stdext::CCharPtrExt; +use crate::sys; use crate::util::wrap; use crate::util::wrappers::AsInnerPtr; use crate::{NixideError, NixideResult}; -use nixide_sys as sys; /// Nix store for managing packages and derivations. /// diff --git a/nixide/src/store/path.rs b/nixide/src/store/path.rs index 0c4e832..e5894f3 100644 --- a/nixide/src/store/path.rs +++ b/nixide/src/store/path.rs @@ -4,13 +4,12 @@ use std::ptr::NonNull; use super::Store; use crate::errors::{new_nixide_error, ErrorContext}; +use crate::sys; use crate::util::panic_issue_call_failed; use crate::util::wrap; use crate::util::wrappers::AsInnerPtr; use crate::NixideResult; -use nixide_sys as sys; - /// A path in the Nix store. /// /// Represents a store path that can be realized, queried, or manipulated. @@ -20,9 +19,20 @@ pub struct StorePath { } impl AsInnerPtr for StorePath { + #[inline] unsafe fn as_ptr(&self) -> *mut sys::StorePath { self.inner.as_ptr() } + + #[inline] + unsafe fn as_ref(&self) -> &sys::StorePath { + unsafe { self.inner.as_ref() } + } + + #[inline] + unsafe fn as_mut(&mut self) -> &mut sys::StorePath { + unsafe { self.inner.as_mut() } + } } impl StorePath { diff --git a/nixide/src/util/wrappers.rs b/nixide/src/util/wrappers.rs index 6fa0378..c3e4b07 100644 --- a/nixide/src/util/wrappers.rs +++ b/nixide/src/util/wrappers.rs @@ -10,7 +10,7 @@ pub trait AsInnerPtr { /// Returns a shared reference to the inner `libnix` C struct. /// - /// For the mutable counterpart see [AsInnerPtr::as_mut]. + /// For the mutable counterpart see [Self::as_mut]. /// /// # Safety /// @@ -21,7 +21,7 @@ pub trait AsInnerPtr { /// Returns a unique reference to the inner `libnix` C struct. /// - /// For the shared counterpart see [AsInnerPtr::as_ref]. + /// For the shared counterpart see [Self::as_ref]. /// /// # Safety ///