Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for encoding directives, arg groups, length-prefixed e-expressions #796

Merged
merged 14 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ edition = "2021"
# We need at least 1.65 for GATs[1] and 1.67 for `ilog`[2]
# [1] https://blog.rust-lang.org/2022/11/03/Rust-1.65.0.html
# [2] https://blog.rust-lang.org/2023/01/26/Rust-1.67.0.html#stabilized-apis
rust-version = "1.67"
rust-version = "1.77"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗺️ Bumping this again while we still can--1.77 added some nice const generics functionality for breaking apart byte arrays.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while we still can

There's a cfg_version RFC that will help with this.

Also, if we haven't already done so, we should define a MSRV policy for this crate.


[features]
default = []
Expand Down Expand Up @@ -63,6 +63,7 @@ smallvec = { version = "1.9.0", features = ["const_generics"] }
bumpalo = { version = "3.15.3", features = ["collections", "std"] }
digest = { version = "0.9", optional = true }
ice_code = "0.1.4"
rustc-hash = "2.0.0"
sha2 = { version = "0.9", optional = true }
serde = { version = "1.0", features = ["derive"], optional = true }
serde_with = { version = "3.7.0", optional = true }
Expand Down
495 changes: 436 additions & 59 deletions benches/read_many_structs.rs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions profile.json

Large diffs are not rendered by default.

19 changes: 18 additions & 1 deletion src/element/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,34 @@ use crate::lazy::encoding::Encoding;
use crate::write_config::WriteConfig;
use crate::IonResult;
use std::cmp::Ordering;
use std::fmt::{Debug, Formatter};
use std::io;

/// An iterable, addressable series of Ion [`Element`]s.
///
/// A `Sequence` is not itself an Ion value type, but can represent a series of Ion values appearing
/// in a [`List`](crate::List), a [`SExp`](crate::SExp), or at the top level.
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq)]
pub struct Sequence {
elements: Vec<Element>,
}

impl Debug for Sequence {
zslayton marked this conversation as resolved.
Show resolved Hide resolved
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "Sequence<")?;
let mut is_first = true;
for element in self {
if is_first {
write!(f, "{element}")?;
} else {
write!(f, ", {element}")?;
is_first = false;
}
}
write!(f, ">")
}
}

impl Sequence {
pub fn new<E: Into<Element>, I: IntoIterator<Item = E>>(elements: I) -> Sequence {
let elements = elements.into_iter().map(|e| e.into()).collect();
Expand Down
Loading
Loading