Can you change this to:

    let border_width = match direction {
        Top => border.top,
        Left => border.left,
        ...
    };
    stroke_opts.line_width = border_width;
    dash[0] = border_width * 3 as AzFloat;
    dash[1] = border_width * 3 as AzFloat;
    stroke_opts.mDashPattern = vec::raw::to_ptr(dash);
    stroke_opts.mDashLength = dash.len() as size_t;

Just to avoid duplicating the stroke option setting code.