fn render_ref_line(
    visualization_data: &VisualizationData,
    resource_owners_layout: &HashMap<&u64, TimelineColumnData>,
    registry: &Handlebars
) -> String {
    let timelines = &visualization_data.timelines;

    let mut output = String::new();
    for (hash, timeline) in timelines{
        match timeline.resource_access_point {
            ResourceAccessPoint::Function(_) => {
                /* do nothing */
            },
            ResourceAccessPoint::Owner(_) | ResourceAccessPoint::MutRef(_) | ResourceAccessPoint::StaticRef(_) =>
            {
                let ro = timeline.resource_access_point.to_owned();
                // verticle state lines
                let states = visualization_data.get_states(hash);

                // struct can live over events
                let mut alive = false;
                let mut data = RefLineData {
                    line_class: String::new(),
                    hash: 0,
                    x1: 0,
                    x2: 0,
                    y1: 0,
                    y2: 0,
                    v: 0,
                    dx: 15,
                    dy: 0,
                    title: String::new(),
                };

                for (line_start, _line_end, state) in states.iter() {
                    match state { // consider removing .clone()
                        State::OutOfScope => {
                            if alive {
                                // finish line template
                                data.x2 = data.x1.clone();
                                data.y2 = get_y_axis_pos(line_start);
                                let dv = get_y_axis_pos(line_start)-data.y1;
                                data.v = dv - 2*dv/5;
                                data.dy = dv/5;

                                match ro {
                                    ResourceAccessPoint::MutRef(_) => {
                                        output.push_str(&registry.render("solid_ref_line_template", &data).unwrap());
                                    },
                                    ResourceAccessPoint::StaticRef(_) => {
                                        output.push_str(&registry.render("hollow_ref_line_template", &data).unwrap());
                                    },
                                    _ => (),
                                }

                                alive = false;
                            }
                        },
                        State::FullPrivilege => {
                            if !alive {
                                // set known vals
                                data.hash = *hash;
                                data.x1 = resource_owners_layout[hash].x_val;
                                data.y1 = get_y_axis_pos(line_start);

                                data.title = String::from("can mutate the resource it refers to");
                                data.line_class = String::from("solid");
                                alive = true;
                            }
                        },
                        State::PartialPrivilege{..} => {
                            if !alive {
                                // set known vals
                                data.hash = *hash;
                                data.x1 = resource_owners_layout[hash].x_val;
                                data.y1 = get_y_axis_pos(line_start);

                                data.title = String::from("cannot mutate the resource it refers to");
                                data.line_class = String::from("solid");
                                alive = true;
                            }
                        },
                        _ => (),
                    }
                }
            }
        }
    }
    output
}
// vertical lines indicating whether a reference can mutate its resource(deref as many times)
// (iff it's a MutRef && it has FullPrivilege)
vertical lines indicating whether a reference can mutate its resource(deref as many times)
(iff it's a MutRef && it has FullPrivilege)
vertical lines indicating whether a reference can mutate its resource ( deref as many times ) ( iff it ' s a MutRef && it has FullPrivilege )
fn render_ref_line(
    visualization_data: &VisualizationData,
    resource_owners_layout: &HashMap<&u64, TimelineColumnData>,
    registry: &Handlebars
) -> String {
    let timelines = &visualization_data.timelines;
    let mut output = String::new();
    for (hash, timeline) in timelines{
        match timeline.resource_access_point {
            ResourceAccessPoint::Function(_) => {
                /* do nothing */
            },
            ResourceAccessPoint::Owner(_) | ResourceAccessPoint::MutRef(_) | ResourceAccessPoint::StaticRef(_) =>
            {
                let ro = timeline.resource_access_point.to_owned();
                // verticle state lines
                let states = visualization_data.get_states(hash);
                // struct can live over events
                let mut alive = false;
                let mut data = RefLineData {
                    line_class: String::new(),
                    hash: 0,
                    x1: 0,
                    x2: 0,
                    y1: 0,
                    y2: 0,
                    v: 0,
                    dx: 15,
                    dy: 0,
                    title: String::new(),
                };
                for (line_start, _line_end, state) in states.iter() {
                    match state { // consider removing .clone()
                        State::OutOfScope => {
                            if alive {
                                // finish line template
                                data.x2 = data.x1.clone();
                                data.y2 = get_y_axis_pos(line_start);
                                let dv = get_y_axis_pos(line_start)-data.y1;
                                data.v = dv - 2*dv/5;
                                data.dy = dv/5;
                                match ro {
                                    ResourceAccessPoint::MutRef(_) => {
                                        output.push_str(&registry.render("solid_ref_line_template", &data).unwrap());
                                    },
                                    ResourceAccessPoint::StaticRef(_) => {
                                        output.push_str(&registry.render("hollow_ref_line_template", &data).unwrap());
                                    },
                                    _ => (),
                                }
                                alive = false;
                            }
                        },
                        State::FullPrivilege => {
                            if !alive {
                                // set known vals
                                data.hash = *hash;
                                data.x1 = resource_owners_layout[hash].x_val;
                                data.y1 = get_y_axis_pos(line_start);
                                data.title = String::from("can mutate the resource it refers to");
                                data.line_class = String::from("solid");
                                alive = true;
                            }
                        },
                        State::PartialPrivilege{..} => {
                            if !alive {
                                // set known vals
                                data.hash = *hash;
                                data.x1 = resource_owners_layout[hash].x_val;
                                data.y1 = get_y_axis_pos(line_start);
                                data.title = String::from("cannot mutate the resource it refers to");
                                data.line_class = String::from("solid");
                                alive = true;
                            }
                        },
                        _ => (),
                    }
                }
            }
        }
    }
    output
}
fn render_ref_line ( visualization_data : & VisualizationData , resource_owners_layout : & HashMap < & u64 , TimelineColumnData > , registry : & Handlebars ) -> String { let timelines = & visualization_data . timelines ; let mut output = String :: new ( ) ; for ( hash , timeline ) in timelines { match timeline . resource_access_point { ResourceAccessPoint :: Function ( _ ) => { /* do nothing */ } , ResourceAccessPoint :: Owner ( _ ) | ResourceAccessPoint :: MutRef ( _ ) | ResourceAccessPoint :: StaticRef ( _ ) => { let ro = timeline . resource_access_point . to_owned ( ) ; // verticle state lines let states = visualization_data . get_states ( hash ) ; // struct can live over events let mut alive = false ; let mut data = RefLineData { line_class : String :: new ( ) , hash : 0 , x1 : 0 , x2 : 0 , y1 : 0 , y2 : 0 , v : 0 , dx : 15 , dy : 0 , title : String :: new ( ) , } ; for ( line_start , _line_end , state ) in states . iter ( ) { match state { // consider removing .clone() State :: OutOfScope => { if alive { // finish line template data . x2 = data . x1 . clone ( ) ; data . y2 = get_y_axis_pos ( line_start ) ; let dv = get_y_axis_pos ( line_start ) - data . y1 ; data . v = dv - 2 * dv / 5 ; data . dy = dv / 5 ; match ro { ResourceAccessPoint :: MutRef ( _ ) => { output . push_str ( & registry . render ( " " , & data ) . unwrap ( ) ) ; } , ResourceAccessPoint :: StaticRef ( _ ) => { output . push_str ( & registry . render ( " " , & data ) . unwrap ( ) ) ; } , _ => ( ) , } alive = false ; } } , State :: FullPrivilege => { if ! alive { // set known vals data . hash = * hash ; data . x1 = resource_owners_layout [ hash ] . x_val ; data . y1 = get_y_axis_pos ( line_start ) ; data . title = String :: from ( " " ) ; data . line_class = String :: from ( " " ) ; alive = true ; } } , State :: PartialPrivilege { .. } => { if ! alive { // set known vals data . hash = * hash ; data . x1 = resource_owners_layout [ hash ] . x_val ; data . y1 = get_y_axis_pos ( line_start ) ; data . title = String :: from ( " " ) ; data . line_class = String :: from ( " " ) ; alive = true ; } } , _ => ( ) , } } } } } output }
vertical lines indicating whether a reference can mutate its resource(deref as many times)
(iff it's a MutRef && it has FullPrivilege)
vertical lines indicating whether a reference can mutate its resource ( deref as many times ) ( iff it ' s a MutRef && it has FullPrivilege )
visualization_data
&VisualizationData
resource_owners_layout
&HashMap<&u64, TimelineColumnData>
registry
&Handlebars