Skip to content

Commit

Permalink
Makes AnnotatableWriter experimentally pub
Browse files Browse the repository at this point in the history
  • Loading branch information
zslayton committed Dec 26, 2024
1 parent fd4e853 commit 158c3ae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/lazy/encoder/value_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,8 @@ pub trait SequenceWriter: MakeValueWriter {
#[cfg(feature = "experimental-reader-writer")]
mod tests {
use crate::symbol_ref::AsSymbolRef;
use crate::IonResult;
use crate::{ion_seq, v1_1, Element, SequenceWriter, Writer};
use crate::{ion_seq, v1_1, Element, IntoAnnotatedElement, SequenceWriter, Writer};
use crate::{AnnotatableWriter, IonResult, ValueWriter};
#[test]
fn save_and_reuse_symbol_id() -> IonResult<()> {
let mut writer = Writer::new(v1_1::Binary, vec![])?;
Expand All @@ -497,15 +497,20 @@ mod tests {
.sid_for("name")
.unwrap();
writer
// Write the symbol twice using its ID
.write_symbol(name_symbol)?
.write_symbol(name_symbol)?
// Use the ID again as an annotation...
.value_writer()
.with_annotations(name_symbol)?
// ...when writing the symbol once more.
.write_symbol(name_symbol)?;
let bytes = writer.close()?;
let actual = Element::read_all(&bytes)?;
let expected = ion_seq!(
"name".as_symbol_ref()
"name".as_symbol_ref()
"name".as_symbol_ref()
"name".as_symbol_ref().with_annotations(["name"])
);
assert_eq!(actual, expected);
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ macro_rules! v1_x_reader_writer {
lazy::value_ref::ValueRef,
lazy::r#struct::{LazyStruct, LazyField},
lazy::sequence::{LazyList, LazySExp},
lazy::encoder::value_writer::{ValueWriter, ContextWriter, StructWriter, SequenceWriter, EExpWriter},
lazy::encoder::value_writer::{AnnotatableWriter, ValueWriter, ContextWriter, StructWriter, SequenceWriter, EExpWriter},
lazy::any_encoding::IonEncoding,
lazy::expanded::compiler::TemplateCompiler,
lazy::expanded::template::TemplateMacro,
Expand Down

0 comments on commit 158c3ae

Please sign in to comment.