fn update_characteristic_axis(
    axis_descr: &mut Vec<AxisDescr>,
    record_layout: Option<&RecordLayout>,
    axis_pts_dim: &HashMap<String, u16>,
    typeinfo: &TypeInfo
) {
    let mut axis_positions = Vec::<Option<u16>>::new();
    // record_layout can only be None if the file is damaged. The spec requires a reference to a valid RECORD_LAYOUT
    if let Some(rl) = record_layout {
        let itemrefs = [
            &rl.axis_pts_x,
            &rl.axis_pts_y,
            &rl.axis_pts_z,
            &rl.axis_pts_4,
            &rl.axis_pts_5
        ];
        for itemref in &itemrefs {
            // the record_layout only describes axes that are internal, i.e. part of the characteristic data structure
            // external axes are described by AXIS_PTS records instead
            if let Some(axisinfo) = itemref {
                // axis information for this axis exists
                axis_positions.push(Some(axisinfo.position));
            } else {
                // no axis information found
                axis_positions.push(None);
            }
        }
    }
    for (idx, axis_descr) in axis_descr.iter_mut().enumerate() {
        if let Some(axis_pts_ref) = &axis_descr.axis_pts_ref {
            // external axis, using AXIS_PTS_REF
            if let Some(max_axis_pts) = axis_pts_dim.get(&axis_pts_ref.axis_points) {
                axis_descr.max_axis_points = *max_axis_pts;
            }
        } else if idx <= 5 {
            // an internal axis, using info from the typeinfo and the record layout
            if let Some(position) = axis_positions[idx] {
                if let Some(TypeInfo::Array{dim, ..}) = get_inner_type(typeinfo, position) {
                    axis_descr.max_axis_points = dim[0] as u16;
                }
            }
        }
    }
}
// update all the AXIS_DESCRs inside a CHARACTERISTIC
// for the list of AXIS_DESCR the ordering matters: the first AXIS_DESCR describes the x axis, the second describes the y axis, etc.
update all the AXIS_DESCRs inside a CHARACTERISTIC
for the list of AXIS_DESCR the ordering matters: the first AXIS_DESCR describes the x axis, the second describes the y axis, etc.
update all the AXIS_DESCRs inside a CHARACTERISTIC for the list of AXIS_DESCR the ordering matters : the first AXIS_DESCR describes the x axis the second describes the y axis etc .
fn update_characteristic_axis(
    axis_descr: &mut Vec<AxisDescr>,
    record_layout: Option<&RecordLayout>,
    axis_pts_dim: &HashMap<String, u16>,
    typeinfo: &TypeInfo
) {
    let mut axis_positions = Vec::<Option<u16>>::new();
    // record_layout can only be None if the file is damaged. The spec requires a reference to a valid RECORD_LAYOUT
    if let Some(rl) = record_layout {
        let itemrefs = [
            &rl.axis_pts_x,
            &rl.axis_pts_y,
            &rl.axis_pts_z,
            &rl.axis_pts_4,
            &rl.axis_pts_5
        ];
        for itemref in &itemrefs {
            // the record_layout only describes axes that are internal, i.e. part of the characteristic data structure
            // external axes are described by AXIS_PTS records instead
            if let Some(axisinfo) = itemref {
                // axis information for this axis exists
                axis_positions.push(Some(axisinfo.position));
            } else {
                // no axis information found
                axis_positions.push(None);
            }
        }
    }
    for (idx, axis_descr) in axis_descr.iter_mut().enumerate() {
        if let Some(axis_pts_ref) = &axis_descr.axis_pts_ref {
            // external axis, using AXIS_PTS_REF
            if let Some(max_axis_pts) = axis_pts_dim.get(&axis_pts_ref.axis_points) {
                axis_descr.max_axis_points = *max_axis_pts;
            }
        } else if idx <= 5 {
            // an internal axis, using info from the typeinfo and the record layout
            if let Some(position) = axis_positions[idx] {
                if let Some(TypeInfo::Array{dim, ..}) = get_inner_type(typeinfo, position) {
                    axis_descr.max_axis_points = dim[0] as u16;
                }
            }
        }
    }
}
fn update_characteristic_axis ( axis_descr : & mut Vec < AxisDescr > , record_layout : Option < & RecordLayout > , axis_pts_dim : & HashMap < String , u16 > , typeinfo : & TypeInfo ) { let mut axis_positions = Vec :: < Option < u16 > > :: new ( ) ; // record_layout can only be None if the file is damaged. The spec requires a reference to a valid RECORD_LAYOUT if let Some ( rl ) = record_layout { let itemrefs = [ & rl . axis_pts_x , & rl . axis_pts_y , & rl . axis_pts_z , & rl . axis_pts_4 , & rl . axis_pts_5 ] ; for itemref in & itemrefs { // the record_layout only describes axes that are internal, i.e. part of the characteristic data structure // external axes are described by AXIS_PTS records instead if let Some ( axisinfo ) = itemref { // axis information for this axis exists axis_positions . push ( Some ( axisinfo . position ) ) ; } else { // no axis information found axis_positions . push ( None ) ; } } } for ( idx , axis_descr ) in axis_descr . iter_mut ( ) . enumerate ( ) { if let Some ( axis_pts_ref ) = & axis_descr . axis_pts_ref { // external axis, using AXIS_PTS_REF if let Some ( max_axis_pts ) = axis_pts_dim . get ( & axis_pts_ref . axis_points ) { axis_descr . max_axis_points = * max_axis_pts ; } } else if idx <= 5 { // an internal axis, using info from the typeinfo and the record layout if let Some ( position ) = axis_positions [ idx ] { if let Some ( TypeInfo :: Array { dim , .. } ) = get_inner_type ( typeinfo , position ) { axis_descr . max_axis_points = dim [ 0 ] as u16 ; } } } } }
update all the AXIS_DESCRs inside a CHARACTERISTIC
for the list of AXIS_DESCR the ordering matters: the first AXIS_DESCR describes the x axis, the second describes the y axis, etc.
update all the AXIS_DESCRs inside a CHARACTERISTIC for the list of AXIS_DESCR the ordering matters : the first AXIS_DESCR describes the x axis the second describes the y axis etc .
axis_descr
&mut Vec<AxisDescr>
record_layout
Option<&RecordLayout>
axis_pts_dim
&HashMap<String, u16>
typeinfo
&TypeInfo