Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ 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.11", features = ["experimental", "experimental-ion-hash"] }
ion-rs = { git = "https://github.com/amazon-ion/ion-rust", branch = "ion11", features = ["experimental", "experimental-ion-hash"] }
tempfile = "3.2.0"
ion-schema = "0.15.0"
ion-schema = { git = "https://github.com/amazon-ion/ion-schema-rust", branch = "ion11" }
lowcharts = "0.5.8"
serde = { version = "1.0.163", features = ["derive"] }
serde_json = { version = "1.0.81", features = ["arbitrary_precision", "preserve_order"] }
Expand Down
16 changes: 8 additions & 8 deletions src/bin/ion/commands/inspect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::output::CommandOutput;
use anyhow::{bail, Context, Result};
use clap::builder::ValueParser;
use clap::{Arg, ArgAction, ArgMatches, Command};
use ion_rs::v1_0::{EncodedBinaryValue, RawValueRef};
use ion_rs::v1_0::{BinaryValueLiteral, RawValueRef};
use ion_rs::*;
use termcolor::{Color, ColorSpec, WriteColor};

Expand Down Expand Up @@ -955,7 +955,7 @@ impl<'a, 'b> IonInspector<'a, 'b> {
&mut self,
depth: usize,
value: LazyValue<'x, AnyEncoding>,
encoded_value: impl EncodedBinaryValue<'x, D>,
encoded_value: impl BinaryValueLiteral<'x, D>,
) -> Result<()> {
if !value.has_annotations() {
return Ok(());
Expand Down Expand Up @@ -1036,7 +1036,7 @@ impl<'a, 'b> IonInspector<'a, 'b> {
fn inspect_literal_container_header<'x, D: Decoder>(
&mut self,
depth: usize,
encoded_value: impl EncodedBinaryValue<'x, D>,
encoded_value: impl BinaryValueLiteral<'x, D>,
) -> Result<()> {
let opcode_bytes: &[u8] = encoded_value.value_opcode_span().bytes();
let mut formatter = BytesFormatter::new(
Expand All @@ -1057,7 +1057,7 @@ impl<'a, 'b> IonInspector<'a, 'b> {
fn inspect_literal_container_footer<'x, D: Decoder>(
&mut self,
depth: usize,
encoded_value: impl EncodedBinaryValue<'x, D>,
encoded_value: impl BinaryValueLiteral<'x, D>,
closing_delimiter: &str,
trailing_delimiter: &str,
) -> Result<()> {
Expand Down Expand Up @@ -1091,7 +1091,7 @@ impl<'a, 'b> IonInspector<'a, 'b> {
depth: usize,
delimiter: &str,
sexp: LazySExp<'x, AnyEncoding>,
encoded_value: impl EncodedBinaryValue<'x, D>,
encoded_value: impl BinaryValueLiteral<'x, D>,
) -> Result<()> {
self.inspect_literal_sequence(
depth,
Expand All @@ -1114,7 +1114,7 @@ impl<'a, 'b> IonInspector<'a, 'b> {
closing_delimiter: &str,
trailing_delimiter: &str,
nested_values: impl IntoIterator<Item = IonResult<ValueExpr<'x, AnyEncoding>>>,
encoded_value: impl EncodedBinaryValue<'x, D>,
encoded_value: impl BinaryValueLiteral<'x, D>,
value_comment_fn: impl CommentFn<'x>,
) -> Result<()> {
self.inspect_literal_container_header(depth, encoded_value)?;
Expand Down Expand Up @@ -1305,7 +1305,7 @@ impl<'a, 'b> IonInspector<'a, 'b> {
depth: usize,
trailing_delimiter: &str,
struct_: LazyStruct<AnyEncoding>,
encoded_value: impl EncodedBinaryValue<'x, D>,
encoded_value: impl BinaryValueLiteral<'x, D>,
kind: StructKind,
) -> Result<()> {
self.inspect_literal_container_header(depth, encoded_value)?;
Expand Down Expand Up @@ -1421,7 +1421,7 @@ impl<'a, 'b> IonInspector<'a, 'b> {
depth: usize,
delimiter: &str,
value: LazyValue<'x, AnyEncoding>,
encoded_value: impl EncodedBinaryValue<'x, D>,
encoded_value: impl BinaryValueLiteral<'x, D>,
mut comment_fn: impl CommentFn<'x>,
) -> Result<()> {
let range = encoded_value.value_span().range();
Expand Down
6 changes: 3 additions & 3 deletions src/bin/ion/commands/jq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,9 @@ impl Sub for JaqElement {
// Number types, only lossless operations
(Int(a), Int(b)) => (a + -b).into(), //TODO: use bare - with ion-rs > rc.11
(Float(a), Float(b)) => a.sub(b).into(),
(Decimal(a), Decimal(b)) => a.sub(b).into(),
(Decimal(a), Int(b)) => a.sub(b).into(),
(Int(a), Decimal(b)) => a.sub(b).into(),
(Decimal(a), Decimal(b)) => DecimalMath::sub(a, b).into(),
(Decimal(a), Int(b)) => DecimalMath::sub(a, b).into(),
(Int(a), Decimal(b)) => DecimalMath::sub(a, b).into(),

// Only try potentially lossy Float conversions when we've run out of the other options
(a @ Int(_) | a @ Decimal(_), Float(b)) => (a.to_f64().unwrap() - b).into(),
Expand Down
2 changes: 1 addition & 1 deletion src/bin/ion/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ pub struct CommandIo<'a> {
}

impl CommandIo<'_> {
fn new(args: &ArgMatches) -> Result<CommandIo> {
fn new(args: &ArgMatches) -> Result<CommandIo<'_>> {
// --format pretty|text|lines|binary
let format = args
.try_get_one("format")
Expand Down
7 changes: 3 additions & 4 deletions src/bin/ion/commands/timestamp_conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ struct TimestampConverter;

impl ElementMapper for TimestampConverter {
fn map(&self, element: Element) -> Result<Element> {
Ok(element.as_text()
.and_then(as_timestamp)
.unwrap_or(element))
Ok(element.as_text().and_then(as_timestamp).unwrap_or(element))
}
}

Expand Down Expand Up @@ -59,6 +57,7 @@ fn as_timestamp(s: &str) -> Option<Element> {
if !is_timestamp_like(s) {
return None;
}
Element::read_one(s.as_bytes()).ok()
Element::read_one(s.as_bytes())
.ok()
.filter(|e| e.ion_type() == IonType::Timestamp)
}
Loading