Module cb

Module cb 

Source
Expand description

FFI callback functions invoked by the ReadStat C library during parsing.

The ReadStat C parser uses a callback-driven architecture: as it reads a .sas7bdat file, it invokes registered callbacks for metadata, variables, and values. Each callback receives a raw *mut c_void context pointer that is cast back to the appropriate Rust struct (ReadStatMetadata or ReadStatData) to accumulate parsed results.

Enumsยง

ReadStatHandler ๐Ÿ”’
Return codes for ReadStat C callback functions.

Constantsยง

DAY_SHIFT ๐Ÿ”’
SAS epoch (1960-01-01) to Unix epoch (1970-01-01) offset in days.
ROUND_SCALE ๐Ÿ”’
Scale factor for rounding: 10^DECIMAL_PLACES, computed once.
SEC_SHIFT ๐Ÿ”’
SAS epoch to Unix epoch offset in seconds.

Functionsยง

handle_metadata ๐Ÿ”’
FFI callback that extracts file-level metadata from the ReadStat C parser.
handle_value ๐Ÿ”’
FFI callback that extracts a single cell value during row parsing.
handle_variable ๐Ÿ”’
FFI callback that extracts per-variable metadata from the ReadStat C parser.
round_decimal_f32 ๐Ÿ”’
Rounds an f32 to [DECIMAL_PLACES] decimal places using pure arithmetic.
round_decimal_f64 ๐Ÿ”’
Rounds an f64 to [DECIMAL_PLACES] decimal places using pure arithmetic.