feat(tvix/eval): implement builtins.toXML
Change-Id: I009efc53a8e98f0650ae660c4decd8216e8a06e7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7835 Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
This commit is contained in:
parent
1786b4c835
commit
d365b09226
11 changed files with 189 additions and 0 deletions
|
|
@ -20,6 +20,7 @@ use crate::{
|
|||
|
||||
use self::versions::{VersionPart, VersionPartsIter};
|
||||
|
||||
mod to_xml;
|
||||
mod versions;
|
||||
|
||||
#[cfg(feature = "impure")]
|
||||
|
|
@ -918,6 +919,14 @@ mod pure_builtins {
|
|||
.map(Value::String)
|
||||
}
|
||||
|
||||
#[builtin("toXML")]
|
||||
fn builtin_to_xml(vm: &mut VM, value: Value) -> Result<Value, ErrorKind> {
|
||||
value.deep_force(vm, &mut Default::default())?;
|
||||
let mut buf: Vec<u8> = vec![];
|
||||
to_xml::value_to_xml(&mut buf, &value)?;
|
||||
Ok(String::from_utf8(buf)?.into())
|
||||
}
|
||||
|
||||
#[builtin("placeholder")]
|
||||
fn builtin_placeholder(vm: &mut VM, #[lazy] _: Value) -> Result<Value, ErrorKind> {
|
||||
// TODO(amjoseph)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue