pub enum FileFormat {
JsonLines,
JsonArray,
Csv,
Xml,
Xlsx,
Parquet,
RawText,
Avro,
Orc,
}Expand description
How the bytes of one object are laid out.
The variants are the union of what the file connectors could previously read or write, so adopting this enum never removes a format from a connector that had it.
Variants§
JsonLines
One JSON value per line (NDJSON). The default everywhere, because it is the only format that both streams and round-trips arbitrary JSON.
JsonArray
A single JSON array holding every record.
Csv
Delimited text. See CsvOptions.
Xml
XML. See XmlOptions.
Xlsx
An Excel workbook (.xlsx). See ExcelOptions.
Parquet
Apache Parquet — named for config, handled by each connector’s own
Arrow path, never by decode/encode.
RawText
Unparsed text: one record per object, {"text": "<whole body>"}.
Avro
Apache Avro Object Container File. See AvroOptions. Read and
write; decodes to records or, with arrow, straight to Arrow batches.
Orc
Apache ORC. See OrcOptions. Read-only — see the orc module
for why there is no writer.
Implementations§
Source§impl FileFormat
impl FileFormat
Sourcepub fn extension(self) -> &'static str
pub fn extension(self) -> &'static str
The conventional file extension, used to name objects a sink creates when the user did not pick one.
Sourcepub fn requires_whole_object(self) -> bool
pub fn requires_whole_object(self) -> bool
Whether the whole object must be in memory to produce the first record.
Callers use this to decide between a streaming read and a buffered one. It is a property of the format, not of the source: a JSON array has no record boundary until it is parsed, a zip-container workbook has its directory at the end, and an XML document is a tree.
Sourcepub fn is_container(self) -> bool
pub fn is_container(self) -> bool
Whether the format is a self-describing binary container decoded by
ContainerDecoder (Avro, ORC) rather than by decode per object.
Sourcepub fn is_writable(self) -> bool
pub fn is_writable(self) -> bool
Whether a sink can write this format through encode.
Sourcepub fn from_path(path: &str) -> Option<Self>
pub fn from_path(path: &str) -> Option<Self>
The format a file name’s extension names, looking through a trailing
compression suffix (.gz, .gzip, .zst, .zstd), so
export.csv.gz is CSV. None for an extension no format claims.
.json is a JSON array (a lone object is one record); .jsonl and
.ndjson are JSON Lines; .tsv is not claimed, because its delimiter
is an option rather than a format.
Trait Implementations§
Source§impl Clone for FileFormat
impl Clone for FileFormat
impl Copy for FileFormat
Source§impl Debug for FileFormat
impl Debug for FileFormat
Source§impl Default for FileFormat
impl Default for FileFormat
Source§impl<'de> Deserialize<'de> for FileFormat
impl<'de> Deserialize<'de> for FileFormat
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for FileFormat
Source§impl JsonSchema for FileFormat
impl JsonSchema for FileFormat
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for FileFormat
impl PartialEq for FileFormat
Source§impl Serialize for FileFormat
impl Serialize for FileFormat
impl StructuralPartialEq for FileFormat
Auto Trait Implementations§
impl Freeze for FileFormat
impl RefUnwindSafe for FileFormat
impl Send for FileFormat
impl Sync for FileFormat
impl Unpin for FileFormat
impl UnsafeUnpin for FileFormat
impl UnwindSafe for FileFormat
Blanket Implementations§
impl<T> Allocation for T
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request