Data export (CSV, JSON, Excel) for Rust applications
| Tier | data |
| Role | unclassified (baselined) |
| Path | crates/data/export |
| Edition | 2021 |
| Targets | data_export |
| Public items | 51 across 0 modules |
| Tests | 25 |
What it is for
Bulk data export library crates for Rust applications.
Provides structured data export to various formats including CSV, JSON, and Excel.
Capabilities
CsvExporter
Bulk data export library crates for Rust applications.
| Item |
|---|
pub struct CsvExporter |
CsvExporter :: fn new(config : ExportConfig) -> Self |
CsvExporter :: fn export <T : Serialize>(& self, data : & T) -> Result <String> |
ExportColumn
Bulk data export library crates for Rust applications.
| Item |
|---|
pub struct ExportColumn |
ExportColumn :: fn new(name : impl Into <String>, source_field : impl Into <String>) -> Self |
ExportColumn :: fn with_display_name(mut self, display_name : impl Into <String>) -> Self |
ExportColumn :: fn with_format(mut self, format : impl Into <String>) -> Self |
ExportColumn :: fn header(& self) -> & str |
ExportConfig
Bulk data export library crates for Rust applications.
| Item |
|---|
pub struct ExportConfig |
ExportConfig :: fn default() -> Self |
ExportConfig :: fn new(format : ExportFormat) -> Self |
ExportConfig :: fn with_column(mut self, column : ExportColumn) -> Self |
ExportConfig :: fn with_columns(mut self, columns : Vec <ExportColumn>) -> Self |
ExportConfig :: fn with_filter(mut self, key : impl Into <String>, value : impl Into <String>) -> Self |
ExportConfig :: fn with_headers(mut self, include : bool) -> Self |
ExportConfig :: fn with_delimiter(mut self, delimiter : char) -> Self |
ExportConfig :: fn with_max_rows(mut self, max : usize) -> Self |
ExportConfig :: fn with_date_format(mut self, format : impl Into <String>) -> Self |
ExportError
Bulk data export library crates for Rust applications.
| Item |
|---|
pub enum ExportError |
ExportFormat
Bulk data export library crates for Rust applications.
| Item |
|---|
pub enum ExportFormat |
ExportFormat :: fn extension(& self) -> & 'static str |
ExportFormat :: fn mime_type(& self) -> & 'static str |
ExportJob
Bulk data export library crates for Rust applications.
| Item |
|---|
pub struct ExportJob |
ExportJob :: fn new(name : impl Into <String>, config : ExportConfig) -> Self |
ExportJob :: fn with_created_by(mut self, user_id : Uuid) -> Self |
ExportJob :: fn with_expires_at(mut self, expires_at : DateTime <Utc>) -> Self |
ExportJob :: fn start(& mut self) -> Result <()> |
ExportJob :: fn update_progress(& mut self, exported : usize, total : Option <usize>) |
ExportJob :: fn complete(& mut self, file_path : String, file_size : u64) |
ExportJob :: fn fail(& mut self, error : impl Into <String>) |
ExportJob :: fn cancel(& mut self) -> Result <()> |
ExportJob :: fn expire(& mut self) |
ExportJob :: fn is_expired(& self) -> bool |
ExportJob :: fn filename(& self) -> String |
ExportStatus
Bulk data export library crates for Rust applications.
| Item |
|---|
pub enum ExportStatus |
ExportStatus :: fn is_terminal(& self) -> bool |
ExportStatus :: fn can_cancel(& self) -> bool |
ExportStatus :: fn as_str(& self) -> & 'static str |
ExportStatus :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result |
ExportStatus :: fn from_str(s : & str) -> std::result::Result <Self, Self::Err> |
ExportTemplate
Bulk data export library crates for Rust applications.
| Item |
|---|
pub struct ExportTemplate |
ExportTemplate :: fn new(name : impl Into <String>, entity_type : impl Into <String>, config : ExportConfig,) -> Self |
ExportTemplate :: fn with_description(mut self, description : impl Into <String>) -> Self |
ExportTemplate :: fn with_public(mut self, is_public : bool) -> Self |
ExportTemplate :: fn with_created_by(mut self, user_id : Uuid) -> Self |
ExportTemplate :: fn create_job(& self, name : impl Into <String>) -> ExportJob |
JsonExporter
Bulk data export library crates for Rust applications.
| Item |
|---|
pub struct JsonExporter |
JsonExporter :: fn new(config : ExportConfig) -> Self |
JsonExporter :: fn export <T : Serialize>(& self, data : & T) -> Result <String> |
JsonExporter :: fn export_lines <T : Serialize>(& self, data : & T) -> Result <String> |
Result
Bulk data export library crates for Rust applications.
| Item |
|---|
pub type Result<T>: std::result::Result <T, ExportError> |
How to use it
No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.
Module structure
No public modules: the crate root is its whole surface.
Public surface
`crate root`
| Item | What it is |
|---|---|
pub enum ExportError | Export errors. |
pub type Result<T>: std::result::Result <T, ExportError> | Result type for export operations. |
pub enum ExportFormat | Supported export formats. |
ExportFormat :: fn extension(& self) -> & 'static str | Get the file extension for this format. |
ExportFormat :: fn mime_type(& self) -> & 'static str | Get the MIME type for this format. |
pub enum ExportStatus | Export job status. |
ExportStatus :: fn is_terminal(& self) -> bool | Check if the export is in a terminal state. |
ExportStatus :: fn can_cancel(& self) -> bool | Check if the export can be cancelled. |
ExportStatus :: fn as_str(& self) -> & 'static str | Returns the string representation for database storage. |
ExportStatus :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result | — |
ExportStatus :: fn from_str(s : & str) -> std::result::Result <Self, Self::Err> | — |
pub struct ExportColumn | Column definition for export. |
ExportColumn :: fn new(name : impl Into <String>, source_field : impl Into <String>) -> Self | Create a new export column. |
ExportColumn :: fn with_display_name(mut self, display_name : impl Into <String>) -> Self | Set the display name. |
ExportColumn :: fn with_format(mut self, format : impl Into <String>) -> Self | Set the format string. |
ExportColumn :: fn header(& self) -> & str | Get the header name for this column. |
pub struct ExportConfig | Export configuration. |
ExportConfig :: fn default() -> Self | — |
ExportConfig :: fn new(format : ExportFormat) -> Self | Create a new export configuration. |
ExportConfig :: fn with_column(mut self, column : ExportColumn) -> Self | Add a column to export. |
ExportConfig :: fn with_columns(mut self, columns : Vec <ExportColumn>) -> Self | Add multiple columns. |
ExportConfig :: fn with_filter(mut self, key : impl Into <String>, value : impl Into <String>) -> Self | Add a filter. |
ExportConfig :: fn with_headers(mut self, include : bool) -> Self | Set whether to include headers. |
ExportConfig :: fn with_delimiter(mut self, delimiter : char) -> Self | Set the delimiter (for CSV). |
ExportConfig :: fn with_max_rows(mut self, max : usize) -> Self | Set the maximum number of rows. |
ExportConfig :: fn with_date_format(mut self, format : impl Into <String>) -> Self | Set the date format. |
pub struct ExportJob | Export job representing an async export operation. |
ExportJob :: fn new(name : impl Into <String>, config : ExportConfig) -> Self | Create a new export job. |
ExportJob :: fn with_created_by(mut self, user_id : Uuid) -> Self | Set the creator. |
ExportJob :: fn with_expires_at(mut self, expires_at : DateTime <Utc>) -> Self | Set expiration time. |
ExportJob :: fn start(& mut self) -> Result <()> | Start processing the export. |
ExportJob :: fn update_progress(& mut self, exported : usize, total : Option <usize>) | Update progress. |
ExportJob :: fn complete(& mut self, file_path : String, file_size : u64) | Mark the export as completed. |
ExportJob :: fn fail(& mut self, error : impl Into <String>) | Mark the export as failed. |
ExportJob :: fn cancel(& mut self) -> Result <()> | Cancel the export. |
ExportJob :: fn expire(& mut self) | Mark as expired. |
ExportJob :: fn is_expired(& self) -> bool | Check if the export has expired. |
ExportJob :: fn filename(& self) -> String | Get the filename for download. |
pub struct ExportTemplate | Export template for reusable export configurations. |
ExportTemplate :: fn new(name : impl Into <String>, entity_type : impl Into <String>, config : ExportConfig,) -> Self | Create a new export template. |
ExportTemplate :: fn with_description(mut self, description : impl Into <String>) -> Self | Set description. |
ExportTemplate :: fn with_public(mut self, is_public : bool) -> Self | Set as public. |
ExportTemplate :: fn with_created_by(mut self, user_id : Uuid) -> Self | Set creator. |
ExportTemplate :: fn create_job(& self, name : impl Into <String>) -> ExportJob | Create an export job from this template. |
pub struct CsvExporter | Simple CSV exporter for synchronous exports. |
CsvExporter :: fn new(config : ExportConfig) -> Self | Create a new CSV exporter. |
CsvExporter :: fn export <T : Serialize>(& self, data : & T) -> Result <String> | Export data to CSV string. |
pub struct JsonExporter | Simple JSON exporter. |
JsonExporter :: fn new(config : ExportConfig) -> Self | Create a new JSON exporter. |
JsonExporter :: fn export <T : Serialize>(& self, data : & T) -> Result <String> | Export data to JSON string. |
JsonExporter :: fn export_lines <T : Serialize>(& self, data : & T) -> Result <String> | Export data to JSON lines format. |
No pub use re-exports: every item above is declared in this crate.
Boundary
Depends on no other workspace tier.
Shares tier data with 2 other crates: data-import, data-webhooks.
_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._
Where it sits
| Tier (ontology) | data |
| Architectural role (taxonomy) | unclassified (baselined) |
| Location | crates/data/export |
| Vocabulary in force (lexicon) | current |
Dependencies
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
async-trait | ^0.1 | — | no | always |
chrono | ^0.4 | serde | no | always |
serde | ^1 | derive | no | always |
serde_json | ^1 | — | no | always |
thiserror | ^2 | — | no | always |
uuid | ^1 | v4, v7, serde, js | no | always |
Development, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
tokio | ^1 | full | no | always |
Build. None.
Depended on by. 2 workspace crates.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR n_application_export["application-export"] -->|uses| SELF n_operations_net_discovery["operations-net-discovery"] -->|uses| SELF SELF["data-export"] classDef self fill:#1f883d,stroke:#1f883d,color:#fff; class SELF self;
Feature flags
No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.
Targets
| Kind | Name | Source |
|---|---|---|
| lib | data_export | `src/lib.rs` |
Error model
| Error type | Named by |
|---|---|
ExportError | Result |
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | none detected |
| async runtime | none detected |
| database access | none detected |
| network I/O | none detected |
| unsafe code | none detected |
| environment variables | none detected |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.
Related capabilities
2 workspace crates depend on this one: application-export, operations-net-discovery.
Verification
| Kind | Count |
|---|---|
| Unit tests | 25 |
| Integration tests | 0 |
| Examples | 0 |
| Doctests | 0 |
Evidence by module. How often each public module is named by something executable.
| Module | Tests | Examples | Consumers |
|---|---|---|---|
crate root | 10 | 0 | 4 |
What the tests establish, by name:
test_csv_exporter_basic—src/lib.rstest_csv_exporter_max_rows—src/lib.rstest_export_column_creation—src/lib.rstest_export_column_header_fallback—src/lib.rstest_export_config_creation—src/lib.rstest_export_config_defaults—src/lib.rstest_export_format_extension—src/lib.rstest_export_format_mime_type—src/lib.rstest_export_job_cancel—src/lib.rstest_export_job_cannot_cancel_completed—src/lib.rstest_export_job_cannot_start_twice—src/lib.rstest_export_job_complete—src/lib.rstest_export_job_creation—src/lib.rstest_export_job_expiration—src/lib.rstest_export_job_fail—src/lib.rstest_export_job_filename—src/lib.rstest_export_job_progress—src/lib.rstest_export_job_start—src/lib.rstest_export_status_can_cancel—src/lib.rstest_export_status_is_terminal—src/lib.rstest_export_template_create_job—src/lib.rstest_export_template_creation—src/lib.rstest_json_exporter—src/lib.rstest_json_lines_exporter—src/lib.rstest_value_to_string—src/lib.rs
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 48 | 51 |
Public modules with a //! block | 0 | 0 |
pie showData
title Public items with rustdoc
"Documented" : 48
"No rustdoc detected" : 3
Metrics
| Metric | Value |
|---|---|
| Rust source files | 1 |
| Source lines | 906 |
| Code lines | 720 |
| Public API items | 51 |
| Public modules | 0 |
| Tests | 25 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 6 |
| Workspace reverse dependencies | 2 |
pie showData
title Public API by kind
"enum" : 3
"method" : 41
"struct" : 6
"type alias" : 1
pie showData
title Rust source composition
"Code" : 720
"Blank or comment" : 186
Generation
Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.