difftreelog
fix experimental build
in: master
4 files changed
crates/jrsonnet-evaluator/src/evaluate/destructure.rsdiffbeforeafterboth--- a/crates/jrsonnet-evaluator/src/evaluate/destructure.rs
+++ b/crates/jrsonnet-evaluator/src/evaluate/destructure.rs
@@ -110,10 +110,7 @@
fn get(self: Box<Self>) -> Result<Self::Output> {
let full = self.full.evaluate()?;
let to = full.len() - self.end;
- Ok(Val::Arr(
- full.slice(Some(self.start), Some(to), None)
- .expect("arguments checked"),
- ))
+ Ok(Val::Arr(full.slice(Some(self.start as i32), Some(to as i32), None)))
}
}
crates/jrsonnet-stdlib/src/manifest/mod.rsdiffbeforeafterboth--- a/crates/jrsonnet-stdlib/src/manifest/mod.rs
+++ b/crates/jrsonnet-stdlib/src/manifest/mod.rs
@@ -10,8 +10,8 @@
};
pub use python::{PythonFormat, PythonVarsFormat};
pub use toml::TomlFormat;
+pub use xml::XmlJsonmlFormat;
pub use yaml::YamlFormat;
-pub use xml::XmlJsonmlFormat;
#[builtin]
pub fn builtin_escape_string_json(str_: IStr) -> Result<String> {
@@ -150,12 +150,30 @@
}
#[builtin]
-pub fn builtin_manifest_python(v: Val) -> Result<String> {
- v.manifest(PythonFormat {})
+pub fn builtin_manifest_python(
+ v: Val,
+
+ #[default(false)]
+ #[cfg(feature = "exp-preserve-order")]
+ preserve_order: bool,
+) -> Result<String> {
+ v.manifest(PythonFormat::std(
+ #[cfg(feature = "exp-preserve-order")]
+ preserve_order,
+ ))
}
#[builtin]
-pub fn builtin_manifest_python_vars(v: Val) -> Result<String> {
- v.manifest(PythonVarsFormat {})
+pub fn builtin_manifest_python_vars(
+ v: Val,
+
+ #[default(false)]
+ #[cfg(feature = "exp-preserve-order")]
+ preserve_order: bool,
+) -> Result<String> {
+ v.manifest(PythonVarsFormat::std(
+ #[cfg(feature = "exp-preserve-order")]
+ preserve_order,
+ ))
}
#[builtin]
crates/jrsonnet-stdlib/src/manifest/python.rsdiffbeforeafterboth9 preserve_order: bool,9 preserve_order: bool,10}10}1112impl PythonFormat {13 pub fn std(#[cfg(feature = "exp-preserve-order")] preserve_order: bool) -> Self {14 Self {15 #[cfg(feature = "exp-preserve-order")]16 preserve_order,17 }18 }19}112012impl ManifestFormat for PythonFormat {21impl ManifestFormat for PythonFormat {13 fn manifest_buf(&self, val: Val, buf: &mut String) -> Result<()> {22 fn manifest_buf(&self, val: Val, buf: &mut String) -> Result<()> {17 Val::Null => buf.push_str("None"),26 Val::Null => buf.push_str("None"),18 Val::Str(s) => escape_string_json_buf(&s.to_string(), buf),27 Val::Str(s) => escape_string_json_buf(&s.to_string(), buf),19 Val::Num(_) => ToStringFormat.manifest_buf(val, buf)?,28 Val::Num(_) => ToStringFormat.manifest_buf(val, buf)?,29 #[cfg(feature = "exp-bigint")]30 Val::BigInt(_) => ToStringFormat.manifest_buf(val, buf)?,20 Val::Arr(arr) => {31 Val::Arr(arr) => {21 buf.push('[');32 buf.push('[');22 for (i, el) in arr.iter().enumerate() {33 for (i, el) in arr.iter().enumerate() {58}69}597060impl PythonVarsFormat {}71impl PythonVarsFormat {72 pub fn std(#[cfg(feature = "exp-preserve-order")] preserve_order: bool) -> Self {73 Self {74 #[cfg(feature = "exp-preserve-order")]75 preserve_order,76 }77 }78}617962impl ManifestFormat for PythonVarsFormat {80impl ManifestFormat for PythonVarsFormat {crates/jrsonnet-stdlib/src/manifest/xml.rsdiffbeforeafterboth--- a/crates/jrsonnet-stdlib/src/manifest/xml.rs
+++ b/crates/jrsonnet-stdlib/src/manifest/xml.rs
@@ -95,7 +95,11 @@
buf.push('<');
buf.push_str(&tag);
attrs.run_assertions()?;
- for (key, value) in attrs.iter() {
+ for (key, value) in attrs.iter(
+ // Not much sense to preserve order here
+ #[cfg(feature = "exp-preserve-order")]
+ false,
+ ) {
buf.push(' ');
buf.push_str(&key);
buf.push('=');