ObjectWriter

Trait ObjectWriter 

Source
pub trait ObjectWriter<T>: Sized {
    // Required methods
    fn write_object(&mut self, object: T) -> Result<()>;
    fn finish_objects(self) -> Result<usize>;

    // Provided method
    fn write_all_objects<I>(&mut self, objects: I) -> Result<usize>
       where I: Iterator<Item = T> { ... }
}
Expand description

Trait for writing objects to some kind of sink.

Required Methods§

Source

fn write_object(&mut self, object: T) -> Result<()>

Write one object.

Source

fn finish_objects(self) -> Result<usize>

Finish and close the target.

Provided Methods§

Source

fn write_all_objects<I>(&mut self, objects: I) -> Result<usize>
where I: Iterator<Item = T>,

Write an iterator full of objects.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T, W> ObjectWriter<T> for &mut W
where 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§

fn write_object(&mut self, object: T) -> Result<()>

Source§

fn finish_objects(self) -> Result<usize>

Source§

impl<T: Serialize, W: Write> ObjectWriter<T> for Writer<W>

Source§

fn write_object(&mut self, object: T) -> Result<()>

Source§

fn finish_objects(self) -> Result<usize>

Source§

impl<W> ObjectWriter<RecordBatch> for ArrowWriter<W>
where W: Write + Send,

Source§

impl<W, R> ObjectWriter<Vec<R>> for SerializedFileWriter<W>
where W: Write + Send, for<'a> &'a [R]: RecordWriter<R>,

Source§

fn write_object(&mut self, object: Vec<R>) -> Result<()>

Source§

fn finish_objects(self) -> Result<usize>

Implementors§