pub struct WriteConfig {
pub(crate) out_path: Option<PathBuf>,
pub(crate) format: OutFormat,
pub(crate) overwrite: bool,
pub(crate) compression: Option<ParquetCompression>,
pub(crate) compression_level: Option<u32>,
}Expand description
Output configuration for writing Arrow data.
Captures the output file path, format, compression settings, and overwrite
behavior. Created separately from ReadStatPath,
which handles only input path validation.
Fields are private and validated by the builder methods; read them via the accessor methods. This prevents constructing a config that bypasses path, extension, and compression-level validation.
Fields§
§out_path: Option<PathBuf>Optional output file path.
format: OutFormatOutput format (defaults to CSV).
overwrite: boolWhether to overwrite an existing output file.
compression: Option<ParquetCompression>Optional Parquet compression algorithm.
compression_level: Option<u32>Optional Parquet compression level.
Implementations§
Source§impl WriteConfig
impl WriteConfig
Sourcepub fn from_output(path: impl Into<PathBuf>) -> Result<Self, ReadStatError>
pub fn from_output(path: impl Into<PathBuf>) -> Result<Self, ReadStatError>
Infers the format from an output path and returns a validated config.
§Errors
Returns ReadStatError if the path has an unknown extension or fails
normal output-path validation.
Sourcepub const fn new(format: OutFormat) -> Self
pub const fn new(format: OutFormat) -> Self
Starts a validated configuration for format. CSV defaults to stdout;
other formats require output before writer creation.
Sourcepub fn output(self, path: impl Into<PathBuf>) -> Result<Self, ReadStatError>
pub fn output(self, path: impl Into<PathBuf>) -> Result<Self, ReadStatError>
Sets and validates the output path.
Sourcepub const fn overwrite(self, overwrite: bool) -> Self
pub const fn overwrite(self, overwrite: bool) -> Self
Controls atomic publication when the writer is successfully finished. When false, publication fails rather than replacing a destination that appeared while the output was being written.
Sourcepub fn compression(
self,
codec: ParquetCompression,
level: Option<u32>,
) -> Result<Self, ReadStatError>
pub fn compression( self, codec: ParquetCompression, level: Option<u32>, ) -> Result<Self, ReadStatError>
Sets and validates Parquet compression.
pub(crate) fn validate(&self) -> Result<(), ReadStatError>
Sourcepub fn out_path(&self) -> Option<&Path>
pub fn out_path(&self) -> Option<&Path>
The validated output path, or None to write CSV to stdout.
Sourcepub const fn is_overwrite(&self) -> bool
pub const fn is_overwrite(&self) -> bool
Whether an existing output file may be overwritten.
Sourcepub const fn compression_codec(&self) -> Option<ParquetCompression>
pub const fn compression_codec(&self) -> Option<ParquetCompression>
The configured Parquet compression codec, if any.
Sourcepub const fn compression_level(&self) -> Option<u32>
pub const fn compression_level(&self) -> Option<u32>
The configured Parquet compression level, if any.
Sourcefn validate_out_extension(
path: &Path,
format: OutFormat,
) -> Result<Option<PathBuf>, ReadStatError>
fn validate_out_extension( path: &Path, format: OutFormat, ) -> Result<Option<PathBuf>, ReadStatError>
Validates the output file extension matches the format.
Sourcefn validate_out_path(
path: Option<PathBuf>,
) -> Result<Option<PathBuf>, ReadStatError>
fn validate_out_path( path: Option<PathBuf>, ) -> Result<Option<PathBuf>, ReadStatError>
Validates the output path exists and handles overwrite logic.
Sourcefn validate_compression_level(
compression: ParquetCompression,
compression_level: Option<u32>,
) -> Result<Option<u32>, ReadStatError>
fn validate_compression_level( compression: ParquetCompression, compression_level: Option<u32>, ) -> Result<Option<u32>, ReadStatError>
Validates compression level is valid for the given compression algorithm.
Trait Implementations§
Source§impl Clone for WriteConfig
impl Clone for WriteConfig
Source§fn clone(&self) -> WriteConfig
fn clone(&self) -> WriteConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for WriteConfig
impl RefUnwindSafe for WriteConfig
impl Send for WriteConfig
impl Sync for WriteConfig
impl Unpin for WriteConfig
impl UnsafeUnpin for WriteConfig
impl UnwindSafe for WriteConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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