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 moresource§impl Debug for NixContext
impl Debug for NixContext
source§impl Default for NixContext
impl Default for NixContext
source§fn default() -> NixContext
fn default() -> NixContext
source§impl<const N: usize> From<[NixContextElement; N]> for NixContext
impl<const N: usize> From<[NixContextElement; N]> for NixContext
source§fn from(value: [NixContextElement; N]) -> Self
fn from(value: [NixContextElement; N]) -> Self
source§impl From<HashSet<NixContextElement, FxBuildHasher>> for NixContext
impl From<HashSet<NixContextElement, FxBuildHasher>> for NixContext
source§fn from(value: FxHashSet<NixContextElement>) -> Self
fn from(value: FxHashSet<NixContextElement>) -> Self
source§impl From<NixContextElement> for NixContext
impl From<NixContextElement> for NixContext
source§fn from(value: NixContextElement) -> Self
fn from(value: NixContextElement) -> Self
source§impl IntoIterator for NixContext
impl IntoIterator for NixContext
Auto Trait Implementations§
impl Freeze for NixContext
impl RefUnwindSafe for NixContext
impl Send for NixContext
impl Sync for NixContext
impl Unpin for NixContext
impl UnwindSafe for NixContext
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more