Struct tvix_eval::value::attrs::NixAttrs

source ·
#[repr(transparent)]
pub struct NixAttrs(pub(super) AttrsRep);

Tuple Fields§

§0: AttrsRep

Implementations§

source§

impl NixAttrs

source

pub fn empty() -> Self

source

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.

source

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.

source

pub fn len(&self) -> usize

Return the number of key-value entries in an attrset.

source

pub fn is_empty(&self) -> bool

source

pub fn select<K>(&self, key: &K) -> Option<&Value>
where K: Borrow<BStr> + ?Sized,

Select a value from an attribute set by key.

source

pub fn select_required<K>(&self, key: &K) -> Result<&Value, ErrorKind>
where K: Borrow<BStr> + ?Sized,

Select a required value from an attribute set by key, return an AttributeNotFound error if it is missing.

source

pub fn contains<'a, K: 'a>(&self, key: K) -> bool
where &'a BStr: From<K>,

source

pub fn iter<'a>(&'a self) -> Iter<KeyValue<'a>>

Construct an iterator over all the key-value pairs in the attribute set.

source

pub fn iter_sorted(&self) -> Iter<KeyValue<'_>>

Same as iter(), but marks call sites which rely on the iteration being lexicographic.

source

pub fn into_iter_sorted(self) -> OwnedAttrsIterator

Same as IntoIterator::into_iter, but marks call sites which rely on the iteration being lexicographic.

source

pub fn keys(&self) -> Keys<'_>

Construct an iterator over all the keys of the attribute set

source

pub fn construct( count: usize, stack_slice: Vec<Value> ) -> Result<Result<Self, CatchableErrorKind>, ErrorKind>

Implement construction logic of an attribute set, to encapsulate logic about attribute set optimisations inside of this module.

source

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

Trait Implementations§

source§

impl Arbitrary for NixAttrs

§

type Parameters = Parameters

The type of parameters that arbitrary_with accepts for configuration of the generated Strategy. Parameters must implement Default.
§

type Strategy = BoxedStrategy<NixAttrs>

The type of Strategy used to generate values of type Self.
source§

fn arbitrary_with(args: Self::Parameters) -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). The strategy is passed the arguments given in args. Read more
source§

fn arbitrary() -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). Read more
source§

impl Clone for NixAttrs

source§

fn clone(&self) -> NixAttrs

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for NixAttrs

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for NixAttrs

source§

fn default() -> NixAttrs

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for NixAttrs

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<OrdMap<NixString, Value>> for NixAttrs

source§

fn from(map: OrdMap<NixString, Value>) -> Self

Converts to this type from the input type.
source§

impl<K, V> FromIterator<(K, V)> for NixAttrs
where NixString: From<K>, Value: From<V>,

source§

fn from_iter<T>(iter: T) -> NixAttrs
where T: IntoIterator<Item = (K, V)>,

Creates a value from an iterator. Read more
source§

impl<'a> IntoIterator for &'a NixAttrs

§

type Item = (&'a NixString, &'a Value)

The type of the elements being iterated over.
§

type IntoIter = Iter<KeyValue<'a>>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl IntoIterator for NixAttrs

§

type Item = (NixString, Value)

The type of the elements being iterated over.
§

type IntoIter = OwnedAttrsIterator

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl TotalDisplay for NixAttrs

source§

fn total_fmt(&self, f: &mut Formatter<'_>, set: &mut ThunkSet) -> Result

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,