doc: Clarify ownership around StorePath::new_*
(cherry picked from commit 397f00e8eefff376759f05bd0cbaecc106c681df)
This commit is contained in:
parent
a2686c31b2
commit
9a6ef0489e
1 changed files with 11 additions and 0 deletions
|
|
@ -6,9 +6,20 @@ pub struct StorePath {
|
|||
raw: *mut raw::StorePath,
|
||||
}
|
||||
impl StorePath {
|
||||
/**
|
||||
* This is a low level function that you shouldn't have to call unless you are developing the Nix bindings.
|
||||
*
|
||||
* Construct a new `StorePath` by first cloning the C store path.
|
||||
* This does not take ownership of the C store path, so it should be a borrowed value, or you should free it.
|
||||
*/
|
||||
pub fn new_raw_clone(raw: *const raw::StorePath) -> Self {
|
||||
Self::new_raw(unsafe { raw::store_path_clone(raw as *mut raw::StorePath) })
|
||||
}
|
||||
/**
|
||||
* This is a low level function that you shouldn't have to call unless you are developing the Nix bindings.
|
||||
*
|
||||
* Takes ownership of a C `nix_store_path`. It will be freed when the `StorePath` is dropped.
|
||||
*/
|
||||
pub fn new_raw(raw: *mut raw::StorePath) -> Self {
|
||||
StorePath { raw }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue