feat(tvix/eval): context-aware coerce_to_string

I am still undecided whether we need a CoercionKind to control
the coerced context, here's a simple attempt.

Change-Id: Ibe59d09ef26c519a6acfdfe392014446646dd6d8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10426
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Autosubmit: raitobezarius <tvl@lahfa.xyz>
This commit is contained in:
Ryan Lahfa 2023-12-26 00:38:40 +01:00 committed by clbot
parent 802f374a90
commit 743c362049
2 changed files with 18 additions and 2 deletions

View file

@ -322,6 +322,10 @@ impl NixString {
Self::new_context_from(context, &s.into_boxed_str())
}
pub(crate) fn context_mut(&mut self) -> Option<&mut NixContext> {
return self.1.as_mut();
}
pub fn iter_plain(&self) -> impl Iterator<Item = &str> {
return self.1.iter().flat_map(|context| context.iter_plain());
}