Struct tvix_eval::NixContext
source · #[repr(transparent)]pub struct NixContext(FxHashSet<NixContextElement>);
Expand description
Nix context strings representation in Tvix. This tracks a set of different kinds of string dependencies that we can come across during manipulation of our language primitives, mostly strings. There’s some simple algebra of context strings and how they propagate w.r.t. primitive operations, e.g. concatenation, interpolation and other string operations.
Tuple Fields§
§0: FxHashSet<NixContextElement>
Implementations§
source§impl NixContext
impl NixContext
sourcepub(crate) fn is_empty(&self) -> bool
pub(crate) fn is_empty(&self) -> bool
For internal consumers, we let people observe if the NixContext is actually empty or not to decide whether they want to skip the allocation of a full blown [HashSet].
sourcepub fn append(self, other: NixContextElement) -> Self
pub fn append(self, other: NixContextElement) -> Self
Consumes a new NixContextElement and add it if not already present in this context.
sourcepub fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = NixContextElement>,
pub fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = NixContextElement>,
Extends the existing context with more context elements.
sourcepub fn mimic(&mut self, other: &NixString)
pub fn mimic(&mut self, other: &NixString)
Copies from another NixString its context strings in this context.
sourcepub fn iter_plain(&self) -> impl Iterator<Item = &str>
pub fn iter_plain(&self) -> impl Iterator<Item = &str>
Iterates over “plain” context elements, e.g. sources imported
in the store without more information, i.e. toFile
or coerced imported paths.
It yields paths to the store.
sourcepub fn iter_derivation(&self) -> impl Iterator<Item = &str>
pub fn iter_derivation(&self) -> impl Iterator<Item = &str>
Iterates over “full derivations” context elements, e.g. something
referring to their drvPath
, i.e. their full sources and binary closure.
It yields derivation paths.
sourcepub fn iter_single_outputs(&self) -> impl Iterator<Item = (&str, &str)>
pub fn iter_single_outputs(&self) -> impl Iterator<Item = (&str, &str)>
Iterates over “single” context elements, e.g. single derived paths, or also known as the single output of a given derivation. The first element of the tuple is the output name and the second element is the derivation path.
sourcepub fn iter(&self) -> impl Iterator<Item = &NixContextElement>
pub fn iter(&self) -> impl Iterator<Item = &NixContextElement>
Iterates over any element of the context.
sourcepub fn to_owned_references(self) -> Vec<String>
pub fn to_owned_references(self) -> Vec<String>
Produces a list of owned references to this current context, no matter its type.
Trait Implementations§
source§impl Clone for NixContext
impl Clone for NixContext
source§fn clone(&self) -> NixContext
fn clone(&self) -> NixContext
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more