Merge remote-tracking branch 'upstream/main' into aanderse/main
This commit is contained in:
commit
7eb94b72f9
26 changed files with 125 additions and 109 deletions
|
|
@ -134,7 +134,6 @@ use anyhow::Context as _;
|
|||
use anyhow::{bail, Result};
|
||||
use cstr::cstr;
|
||||
use lazy_static::lazy_static;
|
||||
use nix_bindings_bindgen_raw as raw;
|
||||
use nix_bindings_store::path::StorePath;
|
||||
use nix_bindings_store::store::{Store, StoreWeak};
|
||||
use nix_bindings_util::context::Context;
|
||||
|
|
@ -142,6 +141,7 @@ use nix_bindings_util::string_return::{
|
|||
callback_get_result_string, callback_get_result_string_data,
|
||||
};
|
||||
use nix_bindings_util::{check_call, check_call_opt_key, result_string_init};
|
||||
use nix_bindings_util_sys as raw;
|
||||
use std::ffi::{c_char, CString};
|
||||
use std::iter::FromIterator;
|
||||
use std::os::raw::c_uint;
|
||||
|
|
@ -669,9 +669,9 @@ impl EvalState {
|
|||
///
|
||||
/// Returns [`Err`] if evaluation failed or the value is not an attribute set.
|
||||
///
|
||||
/// Returns [`Ok(None)`] if the attribute is not present.
|
||||
/// Returns `Ok(None)` if the attribute is not present.
|
||||
///
|
||||
/// Returns [`Ok(Some(value))`] if the attribute is present.
|
||||
/// Returns `Ok(Some(value))` if the attribute is present.
|
||||
#[doc(alias = "nix_get_attr_byname")]
|
||||
#[doc(alias = "get_attr_byname")]
|
||||
#[doc(alias = "get_attr_opt")]
|
||||
|
|
@ -721,11 +721,11 @@ impl EvalState {
|
|||
/// Extracts an element from a [list][`ValueType::List`] Nix value by index.
|
||||
///
|
||||
/// Forces [evaluation](https://nix.dev/manual/nix/latest/language/evaluation.html) and verifies the value is a list.
|
||||
/// Forces evaluation of the selected element, similar to [`require_attrs_select`].
|
||||
/// Forces evaluation of the selected element, similar to [`Self::require_attrs_select`].
|
||||
///
|
||||
/// Returns [`Ok(Some(value))`] if the element is found.
|
||||
/// Returns `Ok(Some(value))` if the element is found.
|
||||
///
|
||||
/// Returns [`Ok(None)`] if the index is out of bounds.
|
||||
/// Returns `Ok(None)` if the index is out of bounds.
|
||||
///
|
||||
/// Returns [`Err`] if evaluation failed, the element contains an error (e.g., `throw`), or the value is not a list.
|
||||
#[doc(alias = "get")]
|
||||
|
|
@ -917,7 +917,7 @@ impl EvalState {
|
|||
/// Applies a function to an argument and returns the result.
|
||||
///
|
||||
/// Forces [evaluation](https://nix.dev/manual/nix/latest/language/evaluation.html) of the function application.
|
||||
/// For a lazy version, see [`new_value_apply`].
|
||||
/// For a lazy version, see [`Self::new_value_apply`].
|
||||
#[doc(alias = "nix_value_call")]
|
||||
#[doc(alias = "value_call")]
|
||||
#[doc(alias = "apply")]
|
||||
|
|
@ -999,7 +999,7 @@ impl EvalState {
|
|||
/// Applies a function to an argument lazily, creating a [thunk](https://nix.dev/manual/nix/latest/language/evaluation.html#laziness).
|
||||
///
|
||||
/// Does not force [evaluation](https://nix.dev/manual/nix/latest/language/evaluation.html) of the function application.
|
||||
/// For an eager version, see [`call`].
|
||||
/// For an eager version, see [`Self::call`].
|
||||
#[doc(alias = "lazy_apply")]
|
||||
#[doc(alias = "thunk_apply")]
|
||||
#[doc(alias = "defer_call")]
|
||||
|
|
@ -1046,10 +1046,10 @@ impl EvalState {
|
|||
Ok(value)
|
||||
}
|
||||
|
||||
/// Creates a new [attribute set][`ValueType::Attrs`] Nix value from an iterator of name-value pairs.
|
||||
/// Creates a new [attribute set][`ValueType::AttrSet`] Nix value from an iterator of name-value pairs.
|
||||
///
|
||||
/// Accepts any iterator that yields `(String, Value)` pairs and has an exact size.
|
||||
/// Common usage includes [`Vec`], [`HashMap`], and array literals.
|
||||
/// Common usage includes [`Vec`], [`std::collections::HashMap`], and array literals.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use crate::eval_state::{EvalState, EvalStateWeak};
|
||||
use crate::value::Value;
|
||||
use anyhow::Result;
|
||||
use nix_bindings_bindgen_raw as raw;
|
||||
use nix_bindings_util::check_call;
|
||||
use nix_bindings_util_sys as raw;
|
||||
use std::ffi::{c_int, c_void, CStr, CString};
|
||||
use std::mem::ManuallyDrop;
|
||||
use std::ptr::{null, null_mut};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
pub mod __private;
|
||||
|
||||
use nix_bindings_bindgen_raw as raw;
|
||||
use nix_bindings_util::{check_call, context::Context};
|
||||
use nix_bindings_util_sys as raw;
|
||||
use std::ptr::{null_mut, NonNull};
|
||||
|
||||
// TODO: test: cloning a thunk does not duplicate the evaluation.
|
||||
|
|
@ -71,7 +71,7 @@ pub struct Value {
|
|||
impl Value {
|
||||
/// Take ownership of a new [`Value`].
|
||||
///
|
||||
/// This does not call [`nix_c_raw::gc_incref`], but does call [`nix_c_raw::nix_gc_decref`] when [dropped][`Drop`].
|
||||
/// This does not call [`nix_bindings_util_sys::gc_incref`], but does call [`nix_bindings_util_sys::gc_decref`] when [dropped][`Drop`].
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
|
|
@ -84,7 +84,7 @@ impl Value {
|
|||
|
||||
/// Borrow a reference to a [`Value`].
|
||||
///
|
||||
/// This calls [`nix_c_raw::value_incref`], and the returned Value will call [`nix_c_raw::value_decref`] when dropped.
|
||||
/// This calls [`nix_bindings_util_sys::value_incref`], and the returned Value will call [`nix_bindings_util_sys::value_decref`] when dropped.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
//! Functions that are relevant for other bindings modules, but normally not end users.
|
||||
use super::Value;
|
||||
use nix_bindings_bindgen_raw as raw;
|
||||
use nix_bindings_util_sys as raw;
|
||||
|
||||
/// Take ownership of a new [`Value`].
|
||||
///
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue