pub struct StreamWriter<W: Write> { /* private fields */ }
Available on crate feature
io_ipc
only.Expand description
Arrow stream writer
The data written by this writer must be read in order. To signal that no more
data is arriving through the stream call self.finish()
;
For a usage walkthrough consult this example.
Implementations§
Source§impl<W: Write> StreamWriter<W>
impl<W: Write> StreamWriter<W>
Sourcepub fn new(writer: W, write_options: WriteOptions) -> Self
pub fn new(writer: W, write_options: WriteOptions) -> Self
Creates a new StreamWriter
Sourcepub fn set_custom_schema_metadata(&mut self, custom_metadata: Arc<Metadata>)
pub fn set_custom_schema_metadata(&mut self, custom_metadata: Arc<Metadata>)
Sets custom schema metadata. Must be called before start
is called
Sourcepub fn start(
&mut self,
schema: &ArrowSchema,
ipc_fields: Option<Vec<IpcField>>,
) -> PolarsResult<()>
pub fn start( &mut self, schema: &ArrowSchema, ipc_fields: Option<Vec<IpcField>>, ) -> PolarsResult<()>
Starts the stream by writing a Schema message to it.
Use ipc_fields
to declare dictionary ids in the schema, for dictionary-reuse
Sourcepub fn write(
&mut self,
columns: &RecordBatchT<Box<dyn Array>>,
ipc_fields: Option<&[IpcField]>,
) -> PolarsResult<()>
pub fn write( &mut self, columns: &RecordBatchT<Box<dyn Array>>, ipc_fields: Option<&[IpcField]>, ) -> PolarsResult<()>
Writes RecordBatchT
to the stream
Sourcepub fn finish(&mut self) -> PolarsResult<()>
pub fn finish(&mut self) -> PolarsResult<()>
Write continuation bytes, and mark the stream as done
Sourcepub fn into_inner(self) -> W
pub fn into_inner(self) -> W
Consumes itself, returning the inner writer.
Auto Trait Implementations§
impl<W> Freeze for StreamWriter<W>where
W: Freeze,
impl<W> !RefUnwindSafe for StreamWriter<W>
impl<W> Send for StreamWriter<W>where
W: Send,
impl<W> Sync for StreamWriter<W>where
W: Sync,
impl<W> Unpin for StreamWriter<W>where
W: Unpin,
impl<W> !UnwindSafe for StreamWriter<W>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more