git.delta.rocks / jrsonnet / refs/commits / 11dc48e90ac0

difftreelog

fix experimental build

Yaroslav Bolyukin2024-05-01parent: #f0883bb.patch.diff
in: master

4 files changed

modifiedcrates/jrsonnet-evaluator/src/evaluate/destructure.rsdiffbeforeafterboth
110 fn get(self: Box<Self>) -> Result<Self::Output> {110 fn get(self: Box<Self>) -> Result<Self::Output> {
111 let full = self.full.evaluate()?;111 let full = self.full.evaluate()?;
112 let to = full.len() - self.end;112 let to = full.len() - self.end;
113 Ok(Val::Arr(113 Ok(Val::Arr(full.slice(Some(self.start as i32), Some(to as i32), None)))
114 full.slice(Some(self.start), Some(to), None)
115 .expect("arguments checked"),
116 ))
117 }114 }
118 }115 }
modifiedcrates/jrsonnet-stdlib/src/manifest/mod.rsdiffbeforeafterboth
10};10};
11pub use python::{PythonFormat, PythonVarsFormat};11pub use python::{PythonFormat, PythonVarsFormat};
12pub use toml::TomlFormat;12pub use toml::TomlFormat;
13pub use yaml::YamlFormat;13pub use xml::XmlJsonmlFormat;
14pub use xml::XmlJsonmlFormat;14pub use yaml::YamlFormat;
1515
16#[builtin]16#[builtin]
17pub fn builtin_escape_string_json(str_: IStr) -> Result<String> {17pub fn builtin_escape_string_json(str_: IStr) -> Result<String> {
151151
152#[builtin]152#[builtin]
153pub fn builtin_manifest_python(v: Val) -> Result<String> {153pub fn builtin_manifest_python(
154 v: Val,
155
156 #[default(false)]
157 #[cfg(feature = "exp-preserve-order")]
158 preserve_order: bool,
159) -> Result<String> {
154 v.manifest(PythonFormat {})160 v.manifest(PythonFormat::std(
161 #[cfg(feature = "exp-preserve-order")]
162 preserve_order,
163 ))
155}164}
156#[builtin]165#[builtin]
157pub fn builtin_manifest_python_vars(v: Val) -> Result<String> {166pub fn builtin_manifest_python_vars(
167 v: Val,
168
169 #[default(false)]
170 #[cfg(feature = "exp-preserve-order")]
171 preserve_order: bool,
172) -> Result<String> {
158 v.manifest(PythonVarsFormat {})173 v.manifest(PythonVarsFormat::std(
174 #[cfg(feature = "exp-preserve-order")]
175 preserve_order,
176 ))
159}177}
160178
161#[builtin]179#[builtin]
modifiedcrates/jrsonnet-stdlib/src/manifest/python.rsdiffbeforeafterboth
9 preserve_order: bool,9 preserve_order: bool,
10}10}
11
12impl 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}
1120
12impl 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}
5970
60impl 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}
6179
62impl ManifestFormat for PythonVarsFormat {80impl ManifestFormat for PythonVarsFormat {
modifiedcrates/jrsonnet-stdlib/src/manifest/xml.rsdiffbeforeafterboth
96 buf.push_str(&tag);96 buf.push_str(&tag);
97 attrs.run_assertions()?;97 attrs.run_assertions()?;
98 for (key, value) in attrs.iter() {98 for (key, value) in attrs.iter(
99 // Not much sense to preserve order here
100 #[cfg(feature = "exp-preserve-order")]
101 false,
102 ) {
99 buf.push(' ');103 buf.push(' ');
100 buf.push_str(&key);104 buf.push_str(&key);