handle_variable

Function handle_variable 

Source
pub(crate) extern "C" fn handle_variable(
    index: c_int,
    variable: *mut readstat_variable_t,
    val_labels: *const c_char,
    ctx: *mut c_void,
) -> c_int
Expand description

FFI callback that extracts per-variable metadata from the ReadStat C parser.

Called once for each variable (column) in the dataset. Populates a ReadStatVarMetadata entry in the ReadStatMetadata::vars map with the variable’s name, type, label, and SAS format classification.

§Safety

  • variable must be a valid pointer to a readstat_variable_t produced by the C parser.
  • ctx must be a valid pointer to a ReadStatMetadata instance that outlives this call.
  • This function must only be called by the ReadStat C library as a registered callback.