pub struct IpcStreamWriter<W> { /* private fields */ }
Available on crate feature
polars-io
only.Expand description
Write a DataFrame to Arrow’s Streaming IPC format
§Example
use polars_core::prelude::*;
use polars_io::ipc::IpcStreamWriter;
use std::fs::File;
use polars_io::SerWriter;
fn example(df: &mut DataFrame) -> PolarsResult<()> {
let mut file = File::create("file.ipc").expect("could not create file");
let mut writer = IpcStreamWriter::new(&mut file);
let custom_metadata = [
("first_name".into(), "John".into()),
("last_name".into(), "Doe".into()),
]
.into_iter()
.collect();
writer.set_custom_schema_metadata(Arc::new(custom_metadata));
writer.finish(df)
}
Implementations§
Source§impl<W> IpcStreamWriter<W>
impl<W> IpcStreamWriter<W>
Sourcepub fn with_compression(
self,
compression: Option<IpcCompression>,
) -> IpcStreamWriter<W>
pub fn with_compression( self, compression: Option<IpcCompression>, ) -> IpcStreamWriter<W>
Set the compression used. Defaults to None.
pub fn with_compat_level(self, compat_level: CompatLevel) -> IpcStreamWriter<W>
Sourcepub fn set_custom_schema_metadata(
&mut self,
custom_metadata: Arc<BTreeMap<PlSmallStr, PlSmallStr>>,
)
pub fn set_custom_schema_metadata( &mut self, custom_metadata: Arc<BTreeMap<PlSmallStr, PlSmallStr>>, )
Sets custom schema metadata. Must be called before start
is called
Trait Implementations§
Auto Trait Implementations§
impl<W> Freeze for IpcStreamWriter<W>where
W: Freeze,
impl<W> RefUnwindSafe for IpcStreamWriter<W>where
W: RefUnwindSafe,
impl<W> Send for IpcStreamWriter<W>where
W: Send,
impl<W> Sync for IpcStreamWriter<W>where
W: Sync,
impl<W> Unpin for IpcStreamWriter<W>where
W: Unpin,
impl<W> UnwindSafe for IpcStreamWriter<W>where
W: UnwindSafe,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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