Skip to content
Open
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
15 changes: 3 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,21 @@ rust-version = "1.82"

[features]
default = []
experimental-ion-hash = ["digest", "experimental-reader-writer"]
experimental-ion-hash = ["digest"]

# Feature for indicating particularly bleeding edge APIs or functionality in the library.
# These are not guaranteed any sort of API stability and may also have non-standard
# Ion behavior (e.g., draft Ion 1.1 capabilities).
# Ion behavior.
experimental = [
"experimental-reader-writer",
"experimental-tooling-apis",
"experimental-serde",
"experimental-ion-1-1",
]

# Feature for indicating explicit opt-in to Ion 1.1
experimental-ion-1-1 = ["experimental-reader-writer"]

# Access to the streaming Reader and Writer types.
# These APIs are functional and well-tested, but are not yet stable.
experimental-reader-writer = []

# Access to low-level encoding information. These APIs are not near stabilization.
experimental-tooling-apis = []

# Experimental serde API to serialize and deserialize Ion data into Rust objects using serde crate
experimental-serde = ["experimental-reader-writer", "dep:serde_with", "dep:serde"]
experimental-serde = ["dep:serde_with", "dep:serde"]

bigdecimal = ["dep:bigdecimal"]

Expand Down
14 changes: 0 additions & 14 deletions src/lazy/any_encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1904,13 +1904,6 @@ mod tests {

expect_int(&mut reader, IonEncoding::Text_1_0, 2)?;

if cfg!(not(feature = "experimental-ion-1-1")) {
reader
.next()
.expect_err("Ion 1.1 IVM should return an error.");
return Ok(());
}

// This IVM changes the encoding from 1.0 text to 1.1 text
expect_version_change(&mut reader, IonEncoding::Text_1_0, IonEncoding::Text_1_1)?;

Expand Down Expand Up @@ -1956,13 +1949,6 @@ mod tests {

expect_int(&mut reader, IonEncoding::Binary_1_0, 2)?;

if cfg!(not(feature = "experimental-ion-1-1")) {
reader
.next()
.expect_err("Ion 1.1 IVM should return an error.");
return Ok(());
}

// This IVM changes the encoding from 1.0 binary to 1.1 binary
expect_version_change(
&mut reader,
Expand Down
1 change: 0 additions & 1 deletion src/lazy/binary/raw/v1_1/binary_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,6 @@ pub struct EncodedAnnotations {
pub sequence_length: u16,
}

#[cfg(feature = "experimental-ion-1-1")]
#[cfg(test)]
mod tests {
use rstest::rstest;
Expand Down
1 change: 0 additions & 1 deletion src/lazy/binary/raw/v1_1/struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ impl<'top> Iterator for RawBinaryStructIterator_1_1<'top> {
}
}

#[cfg(feature = "experimental-ion-1-1")]
#[cfg(test)]
mod tests {
use crate::{
Expand Down
1 change: 0 additions & 1 deletion src/lazy/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@
fn stream_version_after_marker(&self) -> IonResult<IonVersion> {
match self.major_minor() {
(1, 0) => Ok(IonVersion::v1_0),
#[cfg(feature = "experimental-ion-1-1")]
(1, 1) => Ok(IonVersion::v1_1),
(major, minor) => {
IonResult::decoding_error(format!("Ion version {major}.{minor} is not supported"))
Expand Down Expand Up @@ -637,7 +636,7 @@
{
type Iterator: RawSequenceIterator<'top, D>;
fn annotations(&self) -> D::AnnotationsIterator<'top>;
fn ion_type(&self) -> IonType;

Check warning on line 639 in src/lazy/decoder.rs

View workflow job for this annotation

GitHub Actions / Build and Test (al2-arm, default)

method `ion_type` is never used

Check warning on line 639 in src/lazy/decoder.rs

View workflow job for this annotation

GitHub Actions / Build and Test (al2-arm, experimental-ion-hash)

method `ion_type` is never used

Check warning on line 639 in src/lazy/decoder.rs

View workflow job for this annotation

GitHub Actions / Build and Test (al2-x86, experimental-ion-hash)

method `ion_type` is never used

Check warning on line 639 in src/lazy/decoder.rs

View workflow job for this annotation

GitHub Actions / Build and Test (al2-x86, default)

method `ion_type` is never used

Check warning on line 639 in src/lazy/decoder.rs

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu, experimental-ion-hash)

method `ion_type` is never used

Check warning on line 639 in src/lazy/decoder.rs

View workflow job for this annotation

GitHub Actions / Build and Test (macos, default)

method `ion_type` is never used

Check warning on line 639 in src/lazy/decoder.rs

View workflow job for this annotation

GitHub Actions / Build and Test (macos, experimental-ion-hash)

method `ion_type` is never used

Check warning on line 639 in src/lazy/decoder.rs

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu, default)

method `ion_type` is never used

Check warning on line 639 in src/lazy/decoder.rs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, experimental-ion-hash)

method `ion_type` is never used

Check warning on line 639 in src/lazy/decoder.rs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, default)

method `ion_type` is never used
fn iter(&self) -> Self::Iterator;
}

Expand Down
4 changes: 0 additions & 4 deletions src/lazy/encoder/annotate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub trait Annotatable {
///
/// ```
///# use ion_rs::IonResult;
///# #[cfg(feature = "experimental-reader-writer")]
///# fn main() -> IonResult<()> {
/// use ion_rs::{Annotatable, Element, IonData, Writer, v1_0::Text};
///
Expand All @@ -31,10 +30,7 @@ pub trait Annotatable {
/// assert!(IonData::eq(&expected, &actual));
///# Ok(())
///# }
///# #[cfg(not(feature = "experimental-reader-writer"))]
///# fn main() -> IonResult<()> { Ok(()) }
/// ```
#[cfg_attr(not(feature = "experimental-reader-writer"), allow(dead_code))]
fn annotated_with<'a, A: 'a>(&'a self, annotations: A) -> Annotated<'a, Self, A>
where
&'a A: AnnotationSeq<'a>;
Expand Down
1 change: 0 additions & 1 deletion src/lazy/encoder/binary/v1_1/value_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,6 @@ impl<'top> AnnotatableWriter for BinaryEExpParameterValueWriter_1_1<'_, 'top> {
}

#[cfg(test)]
#[cfg(feature = "experimental-ion-1-1")]
mod tests {
use num_traits::FloatConst;
use rstest::rstest;
Expand Down
1 change: 0 additions & 1 deletion src/lazy/encoder/text/v1_1/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ impl<W: Write> LazyRawWriter<W> for LazyRawTextWriter_1_1<W> {
}
}

#[cfg(feature = "experimental-ion-1-1")]
#[cfg(test)]
mod tests {
use crate::lazy::any_encoding::IonVersion;
Expand Down
2 changes: 1 addition & 1 deletion src/lazy/encoder/value_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ pub trait SequenceWriter: MakeValueWriter {
}
}

#[cfg(all(test, feature = "experimental-reader-writer"))]
#[cfg(test)]
mod tests {
use crate::symbol_ref::AsSymbolRef;
use crate::{ion_seq, v1_0, Element, IntoAnnotatedElement, SequenceWriter, Writer};
Expand Down
3 changes: 0 additions & 3 deletions src/lazy/encoder/write_as_ion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ pub trait WriteAsIon {
/// encoded bytes. If the requested encoding is text of any version, returns a `String` instead.
/// ```
///# use ion_rs::IonResult;
///# #[cfg(feature = "experimental-reader-writer")]
///# fn main() -> IonResult<()> {
///# use ion_rs::*;
///
Expand All @@ -53,8 +52,6 @@ pub trait WriteAsIon {
/// assert_eq!(element.as_string().unwrap(), "foo bar baz");
///# Ok(())
///# }
///# #[cfg(not(feature = "experimental-reader-writer"))]
///# fn main() -> IonResult<()> { Ok(()) }
/// ```
fn encode_as<E: Encoding, C: Into<WriteConfig<E>>>(&self, config: C) -> IonResult<E::Output>
where
Expand Down
21 changes: 1 addition & 20 deletions src/lazy/encoder/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ impl Deref for WriterMacroTable {
}

/// An Ion writer that maintains a symbol table and creates new entries as needed.
#[cfg_attr(feature = "experimental-reader-writer", visibility::make(pub))]
pub(crate) struct Writer<E: Encoding, Output: Write> {
pub struct Writer<E: Encoding, Output: Write> {
symbols: WriterSymbolTable,
data_writer: E::Writer<Vec<u8>>,
directive_writer: E::Writer<Vec<u8>>,
Expand All @@ -147,7 +146,6 @@ pub type TextWriter_1_1<Output> = Writer<TextEncoding_1_1, Output>;
#[allow(dead_code)]
pub type BinaryWriter_1_1<Output> = Writer<BinaryEncoding_1_1, Output>;

#[cfg_attr(not(feature = "experimental-reader-writer"), allow(dead_code))]
impl<E: Encoding, Output: Write> Writer<E, Output> {
/// Constructs a writer for the requested encoding using the provided configuration.
pub fn new(config: impl Into<WriteConfig<E>>, output: Output) -> IonResult<Self> {
Expand Down Expand Up @@ -277,18 +275,11 @@ impl<E: Encoding, Output: Write> Writer<E, Output> {
Ok(self.output)
}

#[cfg(feature = "experimental-reader-writer")]
#[inline]
pub fn symbol_table(&self) -> &SymbolTable {
&self.symbols
}

#[cfg(not(feature = "experimental-reader-writer"))]
#[inline]
pub(crate) fn symbol_table(&self) -> &SymbolTable {
&self.symbols
}

/// Helper method to encode an LST append containing pending symbols.
fn write_lst_append(&mut self) -> IonResult<()> {
let Self {
Expand Down Expand Up @@ -433,21 +424,13 @@ impl<'a, V: ValueWriter> ApplicationValueWriter<'a, V> {
}
}

#[cfg(feature = "experimental-reader-writer")]
#[inline]
pub fn symbol_table(&self) -> &SymbolTable {
self.symbols
}

#[cfg(not(feature = "experimental-reader-writer"))]
#[inline]
pub(crate) fn symbol_table(&self) -> &SymbolTable {
self.symbols
}
}

// Generally useful methods, but currently only called in unit tests.
#[cfg_attr(not(feature = "experimental-reader-writer"), allow(dead_code))]
impl ApplicationValueWriter<'_, BinaryValueWriter_1_1<'_, '_>> {
pub fn with_container_encoding(mut self, container_encoding: ContainerEncoding) -> Self {
self.value_writer_config = self
Expand Down Expand Up @@ -752,7 +735,6 @@ impl<'value, V: ValueWriter> ApplicationStructWriter<'value, V> {
}

// Generally useful, but currently only called in unit tests.
#[cfg_attr(not(feature = "experimental-reader-writer"), allow(dead_code))]
pub fn with_field_name_encoding(mut self, field_name_encoding: FieldNameEncoding) -> Self {
self.value_writer_config = self
.value_writer_config
Expand Down Expand Up @@ -1053,7 +1035,6 @@ impl<S: SequenceWriter> ElementWriter for S {
}
}

#[cfg(feature = "experimental-ion-1-1")]
#[cfg(test)]
mod tests {
use crate::lazy::encoder::value_writer::AnnotatableWriter;
Expand Down
1 change: 0 additions & 1 deletion src/lazy/expanded/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1769,7 +1769,6 @@ mod tests {
Ok(())
}

#[cfg(feature = "experimental-ion-1-1")]
#[test]
fn dependent_macros() -> IonResult<()> {
use crate::{AnyEncoding, Element, ElementReader, Reader};
Expand Down
16 changes: 0 additions & 16 deletions src/lazy/expanded/lazy_element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ mod tests {
use crate::lazy::reader::IonResultIterExt;
use crate::{AnyEncoding, Element, IonResult, IonType, Reader, Sequence};

#[cfg(feature = "experimental-ion-1-1")]
fn test_data() -> String {
let test_data = r#"
$ion_1_1
Expand Down Expand Up @@ -201,20 +200,6 @@ mod tests {
test_data.to_owned()
}

#[cfg(not(feature = "experimental-ion-1-1"))]
fn test_data() -> String {
let test_data = r#"
// === Values backed by `ExpandedValueSource::ValueLiteral` ===
foo
true
baz::5
[(), {}, ()]
2025T
"Hello"
"#;
test_data.to_owned()
}

/// Reads the output of `test_data()` twice, once using the `Element` API and again using
/// the `LazyElement` API. The output is passed to `TestFn` to make assertions.
fn lazy_element_test<TestFn>(test: TestFn) -> IonResult<()>
Expand Down Expand Up @@ -283,7 +268,6 @@ mod tests {
}

#[test]
#[cfg(feature = "experimental-ion-1-1")]
fn demonstrate_try_filter_map_1_1() -> IonResult<()> {
let log = r#"
$ion_1_1
Expand Down
2 changes: 1 addition & 1 deletion src/lazy/expanded/macro_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ impl MacroTable {
}
}

#[cfg(all(test, feature = "experimental-ion-1-1"))]
#[cfg(test)]
mod tests {
use crate::lazy::expanded::template::TemplateMacroRef;
use crate::{
Expand Down
5 changes: 1 addition & 4 deletions src/lazy/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use crate::{try_or_some_err, IonError, IonResult, MacroTable, SymbolTable};
/// re-read as long as the reader remains on the same top-level value.
/// ```
///# use ion_rs::IonResult;
///# #[cfg(feature = "experimental-reader-writer")]
///# fn main() -> IonResult<()> {
///
/// // Construct an Element and serialize it as binary Ion.
Expand Down Expand Up @@ -57,8 +56,6 @@ use crate::{try_or_some_err, IonError, IonResult, MacroTable, SymbolTable};
///
///# Ok(())
///# }
///# #[cfg(not(feature = "experimental-reader-writer"))]
///# fn main() -> IonResult<()> { Ok(()) }
/// ```
pub struct Reader<Encoding: Decoder, Input: IonInput> {
system_reader: SystemReader<Encoding, Input>,
Expand Down Expand Up @@ -395,7 +392,7 @@ mod tests {
}
}

#[cfg(all(test, feature = "experimental-ion-1-1"))]
#[cfg(test)]
mod tests_1_1 {
use crate::lazy::text::raw::v1_1::reader::MacroAddress;
use crate::{v1_1, IonResult, MacroTable, Reader};
Expand Down
9 changes: 0 additions & 9 deletions src/lazy/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use crate::{IonError, IonResult};
///
/// ```
///# use ion_rs::IonResult;
///# #[cfg(feature = "experimental-reader-writer")]
///# fn main() -> IonResult<()> {
///
/// // Construct an Element and serialize it as binary Ion.
Expand Down Expand Up @@ -50,8 +49,6 @@ use crate::{IonError, IonResult};
///
///# Ok(())
///# }
///# #[cfg(not(feature = "experimental-reader-writer"))]
///# fn main() -> IonResult<()> { Ok(()) }
/// ```
#[derive(Copy, Clone)]
pub struct LazyList<'top, D: Decoder> {
Expand Down Expand Up @@ -92,7 +89,6 @@ impl<'top, D: Decoder> LazyList<'top, D> {
///
/// ```
///# use ion_rs::IonResult;
///# #[cfg(feature = "experimental-reader-writer")]
///# fn main() -> IonResult<()> {
///
/// // Construct an Element and serialize it as binary Ion.
Expand All @@ -115,8 +111,6 @@ impl<'top, D: Decoder> LazyList<'top, D> {
///
///# Ok(())
///# }
///# #[cfg(not(feature = "experimental-reader-writer"))]
///# fn main() -> IonResult<()> { Ok(()) }
/// ```
pub fn annotations(&self) -> AnnotationsIterator<'top, D> {
AnnotationsIterator {
Expand Down Expand Up @@ -253,7 +247,6 @@ impl<'top, D: Decoder> LazySExp<'top, D> {
///
/// ```
///# use ion_rs::IonResult;
///# #[cfg(feature = "experimental-reader-writer")]
///# fn main() -> IonResult<()> {
///
/// // Construct an Element and serialize it as binary Ion.
Expand All @@ -276,8 +269,6 @@ impl<'top, D: Decoder> LazySExp<'top, D> {
///
///# Ok(())
///# }
///# #[cfg(not(feature = "experimental-reader-writer"))]
///# fn main() -> IonResult<()> { Ok(()) }
/// ```
pub fn annotations(&self) -> AnnotationsIterator<'top, D> {
AnnotationsIterator {
Expand Down
Loading
Loading