Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Rust API Reference

NativeDssFile

The main entry point for all DSS operations. Pure Rust, zero C dependencies.

File Operations

MethodSignatureDescription
createfn create(path: &str) -> io::Result<Self>Create a new empty DSS7 file
openfn open(path: &str) -> io::Result<Self>Open an existing DSS7 file
record_countfn record_count(&self) -> i64Number of records (including aliases)
record_typefn record_type(&mut self, pathname: &str) -> io::Result<i32>Get data type code (0 if not found)
catalogfn catalog(&mut self) -> io::Result<Vec<CatalogEntry>>List all records
catalog_filteredfn catalog_filtered(&mut self, filter: Option<&str>) -> io::Result<Vec<CatalogEntry>>List with wildcard filter

Text Records

MethodSignatureDescription
read_textfn read_text(&mut self, pathname: &str) -> io::Result<Option<String>>Read text (None if not found)
write_textfn write_text(&mut self, pathname: &str, text: &str) -> io::Result<()>Write text record

Time Series

MethodSignatureDescription
read_tsfn read_ts(&mut self, pathname: &str) -> io::Result<Option<TimeSeriesRecord>>Read single-block TS
write_tsfn write_ts(&mut self, pathname: &str, values: &[f64], units: &str, data_type: &str) -> io::Result<()>Write regular TS (doubles)
write_ts_irregularfn write_ts_irregular(&mut self, pathname: &str, times: &[i32], values: &[f64], granularity: i32, units: &str, data_type: &str) -> io::Result<()>Write irregular TS
read_ts_windowfn read_ts_window(&mut self, pathname: &str, start_date: &str, end_date: &str) -> io::Result<Option<TimeSeriesRecord>>Read across blocks with date filter
write_ts_multifn write_ts_multi(&mut self, pathname: &str, values: &[f64], start_date: &str, interval_sec: i32, units: &str, data_type: &str) -> io::Result<()>Write multi-block TS
ts_get_sizesfn ts_get_sizes(&mut self, pathname: &str) -> io::Result<(i32, i32)>Get (num_values, quality_size)
ts_retrieve_infofn ts_retrieve_info(&mut self, pathname: &str) -> io::Result<Option<(String, String)>>Get (units, type) without data
ts_get_date_time_rangefn ts_get_date_time_range(&mut self, pathname: &str) -> io::Result<Option<(i32,i32,i32,i32)>>Get first/last Julian dates

Paired Data

MethodSignatureDescription
read_pdfn read_pd(&mut self, pathname: &str) -> io::Result<Option<PairedDataRecord>>Read paired data
write_pdfn write_pd(&mut self, ..., n_curves: usize, ...) -> io::Result<()>Write paired data (doubles)
pd_retrieve_infofn pd_retrieve_info(&mut self, pathname: &str) -> io::Result<Option<(i32,i32,String,String)>>Get (n_ord, n_curves, units_i, units_d)

Array

MethodSignatureDescription
read_arrayfn read_array(&mut self, pathname: &str) -> io::Result<Option<ArrayRecord>>Read int/float/double arrays
write_arrayfn write_array(&mut self, pathname: &str, ints: &[i32], floats: &[f32], doubles: &[f64]) -> io::Result<()>Write array record

Location

MethodSignatureDescription
read_locationfn read_location(&mut self, pathname: &str) -> io::Result<Option<LocationRecord>>Read coordinates
write_locationfn write_location(&mut self, pathname: &str, loc: &LocationRecord) -> io::Result<()>Write coordinates

Grid / Spatial

MethodSignatureDescription
read_gridfn read_grid(&mut self, pathname: &str) -> io::Result<Option<GridRecord>>Read grid (auto-decompresses)
write_gridfn write_grid(&mut self, ..., nx: i32, ny: i32, data: &[f32], ...) -> io::Result<()>Write grid (auto-compresses)

Record Management

MethodSignatureDescription
deletefn delete(&mut self, pathname: &str) -> io::Result<()>Mark record as deleted
undeletefn undelete(&mut self, pathname: &str) -> io::Result<()>Restore deleted record
squeezefn squeeze(&mut self) -> io::Result<()>Compact file (reclaim space)
copy_recordfn copy_record(&mut self, pathname: &str, dest: &mut NativeDssFile) -> io::Result<bool>Copy one record to another file
copy_filefn copy_file(&mut self, dest: &mut NativeDssFile) -> io::Result<usize>Copy all records
check_filefn check_file(&mut self) -> io::Result<Vec<String>>Validate file integrity

Aliases

MethodSignatureDescription
alias_addfn alias_add(&mut self, primary: &str, alias: &str) -> io::Result<()>Create alias to primary
alias_removefn alias_remove(&mut self, alias: &str) -> io::Result<()>Remove alias
alias_listfn alias_list(&mut self) -> io::Result<Vec<(String, i64)>>List all aliases

CRC / Change Tracking

MethodSignatureDescription
get_data_crcfn get_data_crc(&mut self, pathname: &str) -> io::Result<u32>CRC32 of record data
snapshot_crcsfn snapshot_crcs(&mut self) -> io::Result<Vec<(String, u32)>>Snapshot all CRCs
what_changedfn what_changed(before: &[(String,u32)], after: &[(String,u32)]) -> (Vec<String>, Vec<String>, Vec<String>)Compare snapshots (static)

Data Types

TimeSeriesRecord

#![allow(unused)]
fn main() {
pub struct TimeSeriesRecord {
    pub pathname: String,
    pub values: Vec<f64>,
    pub times: Vec<i32>,
    pub quality: Option<Vec<i32>>,
    pub units: String,
    pub data_type_str: String,
    pub record_type: i32,
    pub time_granularity: i32,
    pub precision: i32,
    pub block_start: i32,
    pub block_end: i32,
    pub number_values: usize,
}
}

PairedDataRecord

#![allow(unused)]
fn main() {
pub struct PairedDataRecord {
    pub pathname: String,
    pub ordinates: Vec<f64>,
    pub values: Vec<f64>,
    pub number_ordinates: usize,
    pub number_curves: usize,
    pub units_independent: String,
    pub units_dependent: String,
    pub labels: Vec<String>,
    pub record_type: i32,
}
}

ArrayRecord, LocationRecord, GridRecord

See source code for complete field listings.

Error Handling

All methods return io::Result<T>. Errors include:

  • File I/O errors (not found, permission denied)
  • Invalid pathname format
  • Empty data arrays
  • Corrupt file structure
  • Record not found (for delete/undelete)