fn _render_arrows_string(
    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 _ = timelines[hash].resource_access_point.to_owned();
                
                for (line_number, event) in timeline.history.iter() {
                    let ro1_x_pos = resource_owners_layout[hash].x_val;
                    let ro1_y_pos = get_y_axis_pos(line_number);
    
                    // render arrow only if ro2 give resource to ro1
                    // i.e. ro2 points to ro1
                    let some_ro2 : Option<ResourceAccessPoint> = match event {
                        Event::Acquire { from : from_ro } => from_ro.to_owned(),
                        Event::MutableBorrow { from : from_ro } => Some(from_ro.to_owned()),
                        Event::StaticBorrow { from : from_ro } => Some(from_ro.to_owned()),
                        Event::StaticReacquire { from : from_ro } => from_ro.to_owned(),
                        Event::MutableReacquire { from: from_ro } => from_ro.to_owned(),
                        _ => None,
                        };
                    let title: String = match event {
                        Event::Acquire { from : Some(from_ro) } => format!("{}{}", String::from("acquire resource from: "), from_ro.name()),
                        Event::MutableBorrow { from : from_ro } => format!("{}{}", String::from("dynamic borrow from: "), from_ro.name()),
                        Event::StaticBorrow { from : from_ro } => format!("{}{}", String::from("static borrow from: "), from_ro.name()),
                        Event::StaticReacquire { from : Some(from_ro) } => format!("{}{}", String::from("static return from: "), from_ro.name()),
                        Event::MutableReacquire { from: Some(from_ro) } => format!("{}{}", String::from("dynamic return from: "), from_ro.name()),
                        _ => String::from(""),
                    };
                    println!("{}", title);
                    if let Some(ro2) = some_ro2 {
                        let mut data = ArrowData {
                            x1: ro1_x_pos,
                            y1: ro1_y_pos,
                            x2: resource_owners_layout[&ro2.hash()].x_val,
                            y2: ro1_y_pos,
                            title: title,
                        };
                        // adjust arrow head pos
                        if data.x1 < data.x2 {
                            data.x1 = data.x1 + 10;
                        }
                        else {
                            data.x1 = data.x1 - 10;
                        }
                        output.push_str(&registry.render("arrow_template", &data).unwrap());
                    }
                }
            },
        }
    }
    output
}
// render events involving two RO using an arrow
// NOTE currently using render_arrows_string_external_events_version instead of this one
render events involving two RO using an arrow
NOTE currently using render_arrows_string_external_events_version instead of this one
render events involving two RO using an arrow NOTE currently using render_arrows_string_external_events_version instead of this one
fn _render_arrows_string(
    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 _ = timelines[hash].resource_access_point.to_owned();
                for (line_number, event) in timeline.history.iter() {
                    let ro1_x_pos = resource_owners_layout[hash].x_val;
                    let ro1_y_pos = get_y_axis_pos(line_number);
                    // render arrow only if ro2 give resource to ro1
                    // i.e. ro2 points to ro1
                    let some_ro2 : Option<ResourceAccessPoint> = match event {
                        Event::Acquire { from : from_ro } => from_ro.to_owned(),
                        Event::MutableBorrow { from : from_ro } => Some(from_ro.to_owned()),
                        Event::StaticBorrow { from : from_ro } => Some(from_ro.to_owned()),
                        Event::StaticReacquire { from : from_ro } => from_ro.to_owned(),
                        Event::MutableReacquire { from: from_ro } => from_ro.to_owned(),
                        _ => None,
                        };
                    let title: String = match event {
                        Event::Acquire { from : Some(from_ro) } => format!("{}{}", String::from("acquire resource from: "), from_ro.name()),
                        Event::MutableBorrow { from : from_ro } => format!("{}{}", String::from("dynamic borrow from: "), from_ro.name()),
                        Event::StaticBorrow { from : from_ro } => format!("{}{}", String::from("static borrow from: "), from_ro.name()),
                        Event::StaticReacquire { from : Some(from_ro) } => format!("{}{}", String::from("static return from: "), from_ro.name()),
                        Event::MutableReacquire { from: Some(from_ro) } => format!("{}{}", String::from("dynamic return from: "), from_ro.name()),
                        _ => String::from(""),
                    };
                    println!("{}", title);
                    if let Some(ro2) = some_ro2 {
                        let mut data = ArrowData {
                            x1: ro1_x_pos,
                            y1: ro1_y_pos,
                            x2: resource_owners_layout[&ro2.hash()].x_val,
                            y2: ro1_y_pos,
                            title: title,
                        };
                        // adjust arrow head pos
                        if data.x1 < data.x2 {
                            data.x1 = data.x1 + 10;
                        }
                        else {
                            data.x1 = data.x1 - 10;
                        }
                        output.push_str(&registry.render("arrow_template", &data).unwrap());
                    }
                }
            },
        }
    }
    output
}
fn _render_arrows_string ( 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 _ = timelines [ hash ] . resource_access_point . to_owned ( ) ; for ( line_number , event ) in timeline . history . iter ( ) { let ro1_x_pos = resource_owners_layout [ hash ] . x_val ; let ro1_y_pos = get_y_axis_pos ( line_number ) ; // render arrow only if ro2 give resource to ro1 // i.e. ro2 points to ro1 let some_ro2 : Option < ResourceAccessPoint > = match event { Event :: Acquire { from : from_ro } => from_ro . to_owned ( ) , Event :: MutableBorrow { from : from_ro } => Some ( from_ro . to_owned ( ) ) , Event :: StaticBorrow { from : from_ro } => Some ( from_ro . to_owned ( ) ) , Event :: StaticReacquire { from : from_ro } => from_ro . to_owned ( ) , Event :: MutableReacquire { from : from_ro } => from_ro . to_owned ( ) , _ => None , } ; let title : String = match event { Event :: Acquire { from : Some ( from_ro ) } => format ! ( " " String from ( " " ) from_ro name ( ) ) , Event :: MutableBorrow { from : from_ro } => format ! ( " " String from ( " " ) from_ro name ( ) ) , Event :: StaticBorrow { from : from_ro } => format ! ( " " String from ( " " ) from_ro name ( ) ) , Event :: StaticReacquire { from : Some ( from_ro ) } => format ! ( " " String from ( " " ) from_ro name ( ) ) , Event :: MutableReacquire { from : Some ( from_ro ) } => format ! ( " " String from ( " " ) from_ro name ( ) ) , _ => String :: from ( " " ) , } ; println ! ( " " title ) ; if let Some ( ro2 ) = some_ro2 { let mut data = ArrowData { x1 : ro1_x_pos , y1 : ro1_y_pos , x2 : resource_owners_layout [ & ro2 . hash ( ) ] . x_val , y2 : ro1_y_pos , title : title , } ; // adjust arrow head pos if data . x1 < data . x2 { data . x1 = data . x1 + 10 ; } else { data . x1 = data . x1 - 10 ; } output . push_str ( & registry . render ( " " , & data ) . unwrap ( ) ) ; } } } , } } output }
render events involving two RO using an arrow
NOTE currently using render_arrows_string_external_events_version instead of this one
render events involving two RO using an arrow NOTE currently using render_arrows_string_external_events_version instead of this one
visualization_data
&VisualizationData
resource_owners_layout
&HashMap<&u64, TimelineColumnData>
registry
&Handlebars