Trait bookdata::io::object::ObjectWriter
source · pub trait ObjectWriter<T>: Sized {
// Required methods
fn write_object(&mut self, object: T) -> Result<()>;
fn finish(self) -> Result<usize>;
// Provided methods
fn write_all_objects<I>(&mut self, objects: I) -> Result<usize>
where I: Iterator<Item = T> { ... }
fn write_and_finish<I>(self, objects: I) -> Result<usize>
where I: Iterator<Item = T> { ... }
fn with_transform<F, T2>(self, transform: F) -> MapWriter<F, T2, T, Self>
where F: Fn(T2) -> Result<T> { ... }
}
Expand description
Trait for writing objects to some kind of sink.
Required Methods§
sourcefn write_object(&mut self, object: T) -> Result<()>
fn write_object(&mut self, object: T) -> Result<()>
Write one object.
Provided Methods§
sourcefn write_all_objects<I>(&mut self, objects: I) -> Result<usize>where
I: Iterator<Item = T>,
fn write_all_objects<I>(&mut self, objects: I) -> Result<usize>where
I: Iterator<Item = T>,
Write an iterator full of objects.
sourcefn write_and_finish<I>(self, objects: I) -> Result<usize>where
I: Iterator<Item = T>,
fn write_and_finish<I>(self, objects: I) -> Result<usize>where
I: Iterator<Item = T>,
Write an iterator of objects and finish the writer.
sourcefn with_transform<F, T2>(self, transform: F) -> MapWriter<F, T2, T, Self>
fn with_transform<F, T2>(self, transform: F) -> MapWriter<F, T2, T, Self>
Wrap this object writer in a transformed writer.
Object Safety§
This trait is not object safe.
Implementations on Foreign Types§
source§impl<T, W> ObjectWriter<T> for &mut Wwhere
W: ObjectWriter<T>,
impl<T, W> ObjectWriter<T> for &mut Wwhere
W: ObjectWriter<T>,
References can be used as object writers; however, ObjectWriter::finish must be called on the owned writer, not a reference. Closing the reference is a no-op.
source§impl<W> ObjectWriter<Chunk<Box<dyn Array>>> for FileWriter<W>where
W: Write,
impl<W> ObjectWriter<Chunk<Box<dyn Array>>> for FileWriter<W>where
W: Write,
Implementation of object writer for Polars Arrow writers
source§impl<W> ObjectWriter<DataFrame> for BatchedWriter<W>where
W: Write,
impl<W> ObjectWriter<DataFrame> for BatchedWriter<W>where
W: Write,
Implementation of object writer for Polars Parquet batched writer