#[repr(transparent)]pub struct NixAttrs(pub(super) AttrsRep);
Tuple Fields§
§0: AttrsRep
Implementations§
source§impl NixAttrs
impl NixAttrs
pub fn empty() -> Self
sourcepub fn ptr_eq(&self, other: &Self) -> bool
pub fn ptr_eq(&self, other: &Self) -> bool
Compare two attribute sets by pointer equality. Only makes
sense for some attribute set reprsentations, i.e. returning
false
does not mean that the two attribute sets do not have
equal content.
sourcepub fn update(self, other: Self) -> Self
pub fn update(self, other: Self) -> Self
Return an attribute set containing the merge of the two
provided sets. Keys from the other
set have precedence.
pub fn is_empty(&self) -> bool
sourcepub fn select_required(&self, key: &str) -> Result<&Value, ErrorKind>
pub fn select_required(&self, key: &str) -> Result<&Value, ErrorKind>
Select a required value from an attribute set by key, return
an AttributeNotFound
error if it is missing.
pub fn contains(&self, key: &str) -> bool
sourcepub fn iter<'a>(&'a self) -> Iter<KeyValue<'a>> ⓘ
pub fn iter<'a>(&'a self) -> Iter<KeyValue<'a>> ⓘ
Construct an iterator over all the key-value pairs in the attribute set.
sourcepub fn iter_sorted(&self) -> Iter<KeyValue<'_>> ⓘ
pub fn iter_sorted(&self) -> Iter<KeyValue<'_>> ⓘ
Same as iter(), but marks call sites which rely on the iteration being lexicographic.
sourcepub fn into_iter_sorted(self) -> OwnedAttrsIterator ⓘ
pub fn into_iter_sorted(self) -> OwnedAttrsIterator ⓘ
Same as IntoIterator::into_iter, but marks call sites which rely on the iteration being lexicographic.
sourcepub fn construct(
count: usize,
stack_slice: Vec<Value>
) -> Result<Self, ErrorKind>
pub fn construct( count: usize, stack_slice: Vec<Value> ) -> Result<Self, ErrorKind>
Implement construction logic of an attribute set, to encapsulate logic about attribute set optimisations inside of this module.
sourcepub(crate) fn from_kv(name: Value, value: Value) -> Self
pub(crate) fn from_kv(name: Value, value: Value) -> Self
Construct an optimized “KV”-style attribute set given the value for the
"name"
key, and the value for the "value"
key
sourcepub(crate) async fn try_to_string(
&self,
co: &GenCo,
kind: CoercionKind
) -> Option<NixString>
pub(crate) async fn try_to_string( &self, co: &GenCo, kind: CoercionKind ) -> Option<NixString>
Attempt to coerce an attribute set with a __toString
attribute to a string.
Trait Implementations§
source§impl Arbitrary for NixAttrs
impl Arbitrary for NixAttrs
§type Parameters = Parameters
type Parameters = Parameters
arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
.§type Strategy = BoxedStrategy<NixAttrs>
type Strategy = BoxedStrategy<NixAttrs>
Strategy
used to generate values of type Self
.