Bulk data import for Rust applications
| Tier | data |
| Role | unclassified (baselined) |
| Path | crates/data/import |
| Edition | 2021 |
| Targets | data_import |
| Public items | 68 across 0 modules |
| Tests | 36 |
What it is for
Bulk data import library crates for Rust applications.
Provides structured data import from various formats with validation and progress tracking.
Capabilities
ColumnMapping
Bulk data import library crates for Rust applications.
| Item |
|---|
pub struct ColumnMapping |
ColumnMapping :: fn new(source : impl Into <String>, target : impl Into <String>) -> Self |
ColumnMapping :: fn required(mut self) -> Self |
ColumnMapping :: fn with_default(mut self, value : impl Into <String>) -> Self |
ColumnMapping :: fn with_transformer(mut self, transformer : impl Into <String>) -> Self |
CsvParser
Bulk data import library crates for Rust applications.
| Item |
|---|
pub struct CsvParser |
CsvParser :: fn new(config : ImportConfig) -> Self |
CsvParser :: fn parse(& self, content : & str) -> Result <Vec <HashMap <String, String>>> |
DuplicateStrategy
Bulk data import library crates for Rust applications.
| Item |
|---|
pub enum DuplicateStrategy |
ImportConfig
Bulk data import library crates for Rust applications.
| Item |
|---|
pub struct ImportConfig |
ImportConfig :: fn default() -> Self |
ImportConfig :: fn new(format : ImportFormat) -> Self |
ImportConfig :: fn with_mapping(mut self, mapping : ColumnMapping) -> Self |
ImportConfig :: fn with_mappings(mut self, mappings : Vec <ColumnMapping>) -> Self |
ImportConfig :: fn with_validation(mut self, rule : ValidationRule) -> Self |
ImportConfig :: fn with_delimiter(mut self, delimiter : char) -> Self |
ImportConfig :: fn with_max_errors(mut self, max : usize) -> Self |
ImportConfig :: fn with_batch_size(mut self, size : usize) -> Self |
ImportConfig :: fn with_duplicate_strategy(mut self, strategy : DuplicateStrategy) -> Self |
ImportConfig :: fn dry_run(mut self) -> Self |
ImportConfig :: fn with_source_label(mut self, label : impl Into <String>) -> Self |
ImportError
Bulk data import library crates for Rust applications.
| Item |
|---|
pub enum ImportError |
ImportFormat
Bulk data import library crates for Rust applications.
| Item |
|---|
pub enum ImportFormat |
ImportFormat :: fn extensions(& self) -> & & 'static str |
ImportFormat :: fn from_extension(ext : & str) -> Option <Self> |
ImportHandler
Bulk data import library crates for Rust applications.
| Item |
|---|
pub trait ImportHandler<T> |
ImportJob:ImportJob
Bulk data import library crates for Rust applications.
| Item |
|---|
pub struct ImportJob |
ImportJob:cancel
Bulk data import library crates for Rust applications.
| Item |
|---|
ImportJob :: fn cancel(& mut self) -> Result <()> |
ImportJob:complete
Bulk data import library crates for Rust applications.
| Item |
|---|
ImportJob :: fn complete(& mut self) |
ImportJob:fail
Bulk data import library crates for Rust applications.
| Item |
|---|
ImportJob :: fn fail(& mut self, error : impl Into <String>) |
ImportJob:new
Bulk data import library crates for Rust applications.
| Item |
|---|
ImportJob :: fn new(name : impl Into <String>, config : ImportConfig) -> Self |
ImportJob:record
Bulk data import library crates for Rust applications.
| Item |
|---|
ImportJob :: fn record_success(& mut self) |
ImportJob :: fn record_skipped(& mut self) |
ImportJob :: fn record_error(& mut self, error : ImportRowError) |
ImportJob:should
Bulk data import library crates for Rust applications.
| Item |
|---|
ImportJob :: fn should_abort(& self) -> bool |
ImportJob:start
Bulk data import library crates for Rust applications.
| Item |
|---|
ImportJob :: fn start_validation(& mut self) -> Result <()> |
ImportJob :: fn start_processing(& mut self, total_rows : usize) |
ImportJob:statistics
Bulk data import library crates for Rust applications.
| Item |
|---|
ImportJob :: fn statistics(& self) -> ImportStatistics |
ImportJob:update
Bulk data import library crates for Rust applications.
| Item |
|---|
ImportJob :: fn update_progress(& mut self, processed : usize) |
ImportJob:with
Bulk data import library crates for Rust applications.
| Item |
|---|
ImportJob :: fn with_file(mut self, name : impl Into <String>, size : u64) -> Self |
ImportJob :: fn with_created_by(mut self, user_id : Uuid) -> Self |
ImportRowError
Bulk data import library crates for Rust applications.
| Item |
|---|
pub struct ImportRowError |
ImportRowError :: fn new(row : usize, message : impl Into <String>) -> Self |
ImportRowError :: fn with_column(mut self, column : impl Into <String>) -> Self |
ImportRowError :: fn with_value(mut self, value : impl Into <String>) -> Self |
ImportStatistics
Bulk data import library crates for Rust applications.
| Item |
|---|
pub struct ImportStatistics |
ImportStatus
Bulk data import library crates for Rust applications.
| Item |
|---|
pub enum ImportStatus |
ImportStatus :: fn is_terminal(& self) -> bool |
ImportStatus :: fn can_cancel(& self) -> bool |
ImportTemplate
Bulk data import library crates for Rust applications.
| Item |
|---|
pub struct ImportTemplate |
ImportTemplate :: fn new(name : impl Into <String>, entity_type : impl Into <String>, config : ImportConfig,) -> Self |
ImportTemplate :: fn with_description(mut self, description : impl Into <String>) -> Self |
ImportTemplate :: fn with_sample_file(mut self, path : impl Into <String>) -> Self |
ImportTemplate :: fn create_job(& self, name : impl Into <String>) -> ImportJob |
KeywordCsvVendor
Bulk data import library crates for Rust applications.
| Item |
|---|
pub enum KeywordCsvVendor |
KeywordCsvVendor :: fn as_str(& self) -> & 'static str |
KeywordCsvVendor :: fn detect(headers : & String) -> Self |
KeywordCsvVendor :: fn resolve_mappings(& self, headers : & String) -> Vec <ColumnMapping> |
KeywordCsvVendor :: fn detect_columns(headers : & String) ->(Self, Vec <ColumnMapping>) |
Result
Bulk data import library crates for Rust applications.
| Item |
|---|
pub type Result<T>: std::result::Result <T, ImportError> |
ValidationRule
Bulk data import library crates for Rust applications.
| Item |
|---|
pub struct ValidationRule |
ValidationRule :: fn required(field : impl Into <String>) -> Self |
ValidationRule :: fn max_length(field : impl Into <String>, max : usize) -> Self |
ValidationRule :: fn email(field : impl Into <String>) -> Self |
ValidationRule :: fn pattern(field : impl Into <String>, regex : impl Into <String>) -> Self |
ValidationRule :: fn in_values(field : impl Into <String>, values : Vec <String>) -> Self |
ValidationRule :: fn with_message(mut self, message : impl Into <String>) -> Self |
ValidationType
Bulk data import library crates for Rust applications.
| Item |
|---|
pub enum ValidationType |
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 ImportError | Import errors. |
pub type Result<T>: std::result::Result <T, ImportError> | Result type for import operations. |
pub enum ImportFormat | Supported import formats. |
ImportFormat :: fn extensions(& self) -> & & 'static str | Get the expected file extensions for this format. |
ImportFormat :: fn from_extension(ext : & str) -> Option <Self> | Detect format from file extension. |
pub enum ImportStatus | Import job status. |
ImportStatus :: fn is_terminal(& self) -> bool | Check if the import is in a terminal state. |
ImportStatus :: fn can_cancel(& self) -> bool | Check if the import can be cancelled. |
pub struct ColumnMapping | Column mapping for import. |
ColumnMapping :: fn new(source : impl Into <String>, target : impl Into <String>) -> Self | Create a new column mapping. |
ColumnMapping :: fn required(mut self) -> Self | Mark as required. |
ColumnMapping :: fn with_default(mut self, value : impl Into <String>) -> Self | Set a default value. |
ColumnMapping :: fn with_transformer(mut self, transformer : impl Into <String>) -> Self | Set a transformer. |
pub struct ValidationRule | Validation rule for import data. |
pub enum ValidationType | Types of validation rules. |
ValidationRule :: fn required(field : impl Into <String>) -> Self | Create a required field rule. |
ValidationRule :: fn max_length(field : impl Into <String>, max : usize) -> Self | Create a max length rule. |
ValidationRule :: fn email(field : impl Into <String>) -> Self | Create an email validation rule. |
ValidationRule :: fn pattern(field : impl Into <String>, regex : impl Into <String>) -> Self | Create a pattern validation rule. |
ValidationRule :: fn in_values(field : impl Into <String>, values : Vec <String>) -> Self | Create an allowed values rule. |
ValidationRule :: fn with_message(mut self, message : impl Into <String>) -> Self | Set a custom error message. |
pub struct ImportConfig | Import configuration. |
pub enum DuplicateStrategy | Strategy for handling duplicate records. |
ImportConfig :: fn default() -> Self | — |
ImportConfig :: fn new(format : ImportFormat) -> Self | Create a new import configuration. |
ImportConfig :: fn with_mapping(mut self, mapping : ColumnMapping) -> Self | Add a column mapping. |
ImportConfig :: fn with_mappings(mut self, mappings : Vec <ColumnMapping>) -> Self | Add multiple mappings. |
ImportConfig :: fn with_validation(mut self, rule : ValidationRule) -> Self | Add a validation rule. |
ImportConfig :: fn with_delimiter(mut self, delimiter : char) -> Self | Set the delimiter (for CSV). |
ImportConfig :: fn with_max_errors(mut self, max : usize) -> Self | Set the maximum number of errors before aborting. |
ImportConfig :: fn with_batch_size(mut self, size : usize) -> Self | Set the batch size for processing. |
ImportConfig :: fn with_duplicate_strategy(mut self, strategy : DuplicateStrategy) -> Self | Set the duplicate handling strategy. |
ImportConfig :: fn dry_run(mut self) -> Self | Enable dry run mode. |
ImportConfig :: fn with_source_label(mut self, label : impl Into <String>) -> Self | Tag this config with a source-system label (e.g |
pub struct ImportRowError | A single import error record. |
ImportRowError :: fn new(row : usize, message : impl Into <String>) -> Self | Create a new row error. |
ImportRowError :: fn with_column(mut self, column : impl Into <String>) -> Self | Set the column. |
ImportRowError :: fn with_value(mut self, value : impl Into <String>) -> Self | Set the value. |
pub struct ImportJob | Import job representing an async import operation. |
ImportJob :: fn new(name : impl Into <String>, config : ImportConfig) -> Self | Create a new import job. |
ImportJob :: fn with_file(mut self, name : impl Into <String>, size : u64) -> Self | Set the file information. |
ImportJob :: fn with_created_by(mut self, user_id : Uuid) -> Self | Set the creator. |
ImportJob :: fn start_validation(& mut self) -> Result <()> | Start the validation phase. |
ImportJob :: fn start_processing(& mut self, total_rows : usize) | Start the processing phase. |
ImportJob :: fn update_progress(& mut self, processed : usize) | Update progress. |
ImportJob :: fn record_success(& mut self) | Record a successful import. |
ImportJob :: fn record_skipped(& mut self) | Record a skipped row. |
ImportJob :: fn record_error(& mut self, error : ImportRowError) | Record an error. |
ImportJob :: fn should_abort(& self) -> bool | Check if the import should abort due to too many errors. |
ImportJob :: fn complete(& mut self) | Mark the import as completed. |
ImportJob :: fn fail(& mut self, error : impl Into <String>) | Mark the import as failed. |
ImportJob :: fn cancel(& mut self) -> Result <()> | Cancel the import. |
ImportJob :: fn statistics(& self) -> ImportStatistics | Get import statistics. |
pub struct ImportStatistics | Import statistics summary. |
pub struct ImportTemplate | Import template for reusable import configurations. |
ImportTemplate :: fn new(name : impl Into <String>, entity_type : impl Into <String>, config : ImportConfig,) -> Self | Create a new import template. |
ImportTemplate :: fn with_description(mut self, description : impl Into <String>) -> Self | Set description. |
ImportTemplate :: fn with_sample_file(mut self, path : impl Into <String>) -> Self | Set sample file path. |
ImportTemplate :: fn create_job(& self, name : impl Into <String>) -> ImportJob | Create an import job from this template. |
pub trait ImportHandler<T> | Trait for import record handlers. |
pub struct CsvParser | Simple CSV parser for synchronous imports. |
CsvParser :: fn new(config : ImportConfig) -> Self | Create a new CSV parser. |
CsvParser :: fn parse(& self, content : & str) -> Result <Vec <HashMap <String, String>>> | Parse CSV content into rows. |
pub enum KeywordCsvVendor | Known keyword-research CSV export vendors, plus a generic fallback |
KeywordCsvVendor :: fn as_str(& self) -> & 'static str | Lowercase label for this vendor (matches this crate's serde snake_case wire format), suitable for ImportConfig::with_source_label. |
KeywordCsvVendor :: fn detect(headers : & String) -> Self | Detect which vendor's known header spellings a real CSV header row matches, by looking for each vendor's distinctive markers -- header spellings not shared with any other vendor's candidate list for the same field |
KeywordCsvVendor :: fn resolve_mappings(& self, headers : & String) -> Vec <ColumnMapping> | Resolve this vendor's known header-name spellings against a real CSV header row |
KeywordCsvVendor :: fn detect_columns(headers : & String) ->(Self, Vec <ColumnMapping>) | Single entry point: detect the vendor from the header row, then resolve its column mappings against those same headers |
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-export, 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/import |
| 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. 1 workspace crate.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR n_application_import["application-import"] -->|uses| SELF SELF["data-import"] 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_import | `src/lib.rs` |
Error model
| Error type | Named by |
|---|---|
ImportError | Result |
ImportRowError | declared, no public signature returns it |
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
1 workspace crate depends on this one: application-import.
Verification
| Kind | Count |
|---|---|
| Unit tests | 36 |
| 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 | 16 | 0 | 1 |
What the tests establish, by name:
test_column_mapping_creation—src/lib.rstest_csv_parser_basic—src/lib.rstest_csv_parser_custom_delimiter—src/lib.rstest_csv_parser_empty—src/lib.rstest_csv_parser_with_mapping—src/lib.rstest_detect_columns_ahrefs—src/lib.rstest_detect_columns_generic_fallback_no_panic—src/lib.rstest_detect_columns_semrush—src/lib.rstest_detect_columns_ubersuggest—src/lib.rstest_duplicate_strategy_default—src/lib.rstest_import_config_creation—src/lib.rstest_import_config_dry_run—src/lib.rstest_import_config_with_source_label—src/lib.rstest_import_format_extensions—src/lib.rstest_import_format_from_extension—src/lib.rstest_import_job_cancel—src/lib.rstest_import_job_cannot_start_twice—src/lib.rstest_import_job_complete_partial—src/lib.rstest_import_job_complete_success—src/lib.rstest_import_job_creation—src/lib.rstest_import_job_progress—src/lib.rstest_import_job_record_error—src/lib.rstest_import_job_record_success—src/lib.rstest_import_job_should_abort—src/lib.rstest_import_job_start_processing—src/lib.rstest_import_job_start_validation—src/lib.rstest_import_job_statistics—src/lib.rstest_import_job_with_file—src/lib.rstest_import_row_error—src/lib.rstest_import_status_can_cancel—src/lib.rs- _… 6 more_
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 67 | 68 |
Public modules with a //! block | 0 | 0 |
pie showData
title Public items with rustdoc
"Documented" : 67
"No rustdoc detected" : 1
Metrics
| Metric | Value |
|---|---|
| Rust source files | 1 |
| Source lines | 1442 |
| Code lines | 1144 |
| Public API items | 68 |
| Public modules | 0 |
| Tests | 36 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 6 |
| Workspace reverse dependencies | 1 |
pie showData
title Public API by kind
"enum" : 6
"method" : 52
"struct" : 8
"trait" : 1
"type alias" : 1
pie showData
title Rust source composition
"Code" : 1144
"Blank or comment" : 298
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.