Skip to content

Commit

Permalink
Shows e-exprs inside container literals, delimited END (#186)
Browse files Browse the repository at this point in the history
* Shows e-exprs inside container literals, delimited END
* Improves rendering of eexps, arg groups, comments
* Upgrade ion-rs to rc.11
  • Loading branch information
zslayton authored Jan 10, 2025
1 parent 00fbcdb commit 4c8b913
Show file tree
Hide file tree
Showing 10 changed files with 662 additions and 568 deletions.
410 changes: 207 additions & 203 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ flate2 = "1.0"
infer = "0.15.0"
# ion-rs version must be pinned because we are using experimental features
# See https://github.com/amazon-ion/ion-cli/issues/155
ion-rs = { version = "1.0.0-rc.10", features = ["experimental", "experimental-ion-hash"] }
ion-rs = { version = "1.0.0-rc.11", features = ["experimental", "experimental-ion-hash"] }
tempfile = "3.2.0"
ion-schema = "0.15.0"
lowcharts = "0.5.8"
Expand Down
2 changes: 1 addition & 1 deletion src/bin/ion/commands/generate/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl<'a> CodeGenerator<'a, JavaLanguage> {
}
}

impl<'a, L: Language + 'static> CodeGenerator<'a, L> {
impl<L: Language + 'static> CodeGenerator<'_, L> {
/// A [tera] filter that converts given tera string value to [upper camel case].
/// Returns error if the given value is not a string.
///
Expand Down
11 changes: 9 additions & 2 deletions src/bin/ion/commands/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use ion_rs::ion_hash::IonHasher;
use ion_rs::*;
use sha2::{Sha256, Sha512};
use sha3::{Sha3_256, Sha3_512};
use std::fmt;
use std::io::Write;

// Macro to eliminate repetitive code for each hash algorithm.
Expand Down Expand Up @@ -109,8 +110,14 @@ impl IonCliCommand for HashCommand {
for elem in reader.elements() {
let elem = elem?;
let digest = hasher.hash_it(&elem)?;
let digest_string: String =
digest.iter().map(|b| format!("{:02x?}", b)).collect();
let digest_string = digest.iter().fold(
String::with_capacity(digest.len() * 2),
|mut string, byte| {
use fmt::Write;
write!(&mut string, "{:02x}", byte).expect("infallible");
string
},
);
output.write_all(digest_string.as_bytes())?;
output.write_all("\n".as_bytes())?;
}
Expand Down
Loading

0 comments on commit 4c8b913

Please sign in to comment.