Skip to content

Commit

Permalink
Adds suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
desaikd committed Jul 1, 2024
1 parent 18ad531 commit 3daa534
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/lazy/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,21 +496,21 @@ mod tests {
#[case::typed_null("null.list", IonType::List)]
#[case::annotated_typed_null("foo::null.list", IonType::List.with_annotations(["foo"]))]
#[case::boolean("false", false)]
#[case::negative_int("-1", - 1)]
#[case::negative_int("-1", -1)]
#[case::int_zero("0", 0)]
#[case::positive_int("1", 1)]
#[case::float_zero("0e0", 0f64)]
#[case::float("2.5e0", 2.5f64)]
#[case::special_float("-inf", f64::neg_infinity())]
#[case::decimal("3.14159", Decimal::new(314159, - 5))]
#[case::timestamp("2023-04-29T", Timestamp::with_ymd(2023, 4, 29).build() ?)]
#[case::decimal("3.14159", Decimal::new(314159, -5))]
#[case::timestamp("2023-04-29T", Timestamp::with_ymd(2023, 4, 29).build()?)]
#[case::symbol("foo", Symbol::owned("foo"))]
#[case::string("\"hello\"", "hello")]
#[case::blob("{{Blob}}", Element::blob([0x06, 0x5A, 0x1B]))]
#[case::clob("{{\"Clob\"}}", Element::clob("Clob".as_bytes()))]
#[case::list("[1, 2, 3]", ion_list ! [1, 2, 3])]
#[case::sexp("(1 2 3)", ion_sexp ! (1 2 3))]
#[case::struct_("{foo: 1, bar: 2}", ion_struct ! {"foo": 1, "bar": 2})]
#[case::list("[1, 2, 3]", ion_list![1, 2, 3])]
#[case::sexp("(1 2 3)", ion_sexp!(1 2 3))]
#[case::struct_("{foo: 1, bar: 2}", ion_struct! {"foo": 1, "bar": 2})]
fn try_into_element(
#[case] ion_text: &str,
#[case] expected: impl Into<Element>,
Expand Down
12 changes: 6 additions & 6 deletions src/serde/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ where
let item = reader.next_item()?;
match item {
SystemStreamItem::VersionMarker(marker) => {
// Note that this uses an older encoding here, but the format (i.e text or binary) stays the same which is why using the older encoding here works fine.
// Note that this uses the Ion version with which the IVM was encoded rather than
// the Ion version the stream is switching to. We can do this because the format
// (i.e text or binary) stays the same when the version changes.
// TODO: Use new encoding, once we have APIs to get new/old encodings for the marker.
let is_human_readable = marker.encoding().is_text();
let value = reader.expect_next_value()?;
Expand All @@ -33,11 +35,9 @@ where
let value_deserializer = ValueDeserializer::new(&value, true);
T::deserialize(value_deserializer)
}
_ => {
return IonResult::decoding_error(
"The first item found as symbol table or end of stream while reading",
);
}
_ => IonResult::decoding_error(
"The first item found as symbol table or end of stream while reading",
),
}
}

Expand Down

0 comments on commit 3daa534

Please sign in to comment.