Skip to content

Commit

Permalink
Moved code into more cohesive modules
Browse files Browse the repository at this point in the history
  • Loading branch information
zslayton committed Dec 8, 2023
1 parent e178fcc commit 1d40d04
Show file tree
Hide file tree
Showing 6 changed files with 631 additions and 604 deletions.
2 changes: 1 addition & 1 deletion src/lazy/encoder/annotate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub trait Annotate {
///# use ion_rs::IonResult;
///# fn main() -> IonResult<()> {
/// use ion_rs::{Element, IonData};
/// use ion_rs::lazy::encoder::LazyRawTextWriter_1_0;
/// use ion_rs::lazy::encoder::text::LazyRawTextWriter_1_0;
/// use ion_rs::lazy::encoder::annotate::Annotate;
///
/// let mut buffer = vec![];
Expand Down
9 changes: 5 additions & 4 deletions src/lazy/encoder/binary/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ use crate::lazy::encoder::binary::value_writer::{
BinaryAnnotatableValueWriter_1_0, MAX_INLINE_LENGTH,
};
use crate::lazy::encoder::private::Sealed;
use crate::lazy::encoder::value_writer::{MakeValueWriter, SequenceWriter, StructWriter};
use crate::lazy::encoder::value_writer::internal::MakeValueWriter;
use crate::lazy::encoder::value_writer::{SequenceWriter, StructWriter};
use crate::lazy::encoder::write_as_ion::WriteAsIon;
use crate::lazy::encoder::{LazyEncoder, LazyRawWriter};
use crate::lazy::encoding::BinaryEncoding_1_0;
Expand Down Expand Up @@ -71,7 +72,7 @@ impl<W: Write> LazyRawBinaryWriter_1_0<W> {
}

/// Writes the given Rust value to the output stream as a top-level value.
fn write<V: WriteAsIon>(&mut self, value: V) -> IonResult<&mut Self> {
pub fn write<V: WriteAsIon>(&mut self, value: V) -> IonResult<&mut Self> {
value.write_as_ion(self.value_writer())?;
Ok(self)
}
Expand All @@ -80,7 +81,7 @@ impl<W: Write> LazyRawBinaryWriter_1_0<W> {
///
/// Calling `flush` also releases memory used for bookkeeping and storage, but calling it
/// frequently can reduce overall throughput.
fn flush(&mut self) -> IonResult<()> {
pub fn flush(&mut self) -> IonResult<()> {
// Temporarily break apart `self` to get simultaneous references to its innards.
let Self {
output,
Expand All @@ -103,7 +104,7 @@ impl<W: Write> LazyRawBinaryWriter_1_0<W> {
Ok(())
}

fn value_writer(&mut self) -> BinaryAnnotatableValueWriter_1_0<'_, '_> {
pub fn value_writer(&mut self) -> BinaryAnnotatableValueWriter_1_0<'_, '_> {
let top_level = match self.encoding_buffer_ptr {
// If the `encoding_buffer_ptr` is set, we already allocated an encoding buffer on
// a previous call to `value_writer()`. Dereference the pointer and continue encoding
Expand Down
Loading

0 comments on commit 1d40d04

Please sign in to comment.