@@ -41,35 +41,42 @@ pub struct JunctionAnnotations {
41
41
pub unannotated_reference : JunctionsMap ,
42
42
}
43
43
44
- // TODO: This is a temporary implementation. It should be replaced with something better.
45
44
impl Serialize for JunctionAnnotations {
46
45
fn serialize < S : Serializer > ( & self , serializer : S ) -> Result < S :: Ok , S :: Error > {
47
46
let mut known = Vec :: new ( ) ;
48
47
for ( ref_name, junctions) in & self . known {
48
+ let mut junctions_vec = Vec :: new ( ) ;
49
49
for ( ( start, end) , count) in junctions {
50
- known . push ( ( ref_name , start. get ( ) , end. get ( ) , count) ) ;
50
+ junctions_vec . push ( ( start. get ( ) , end. get ( ) , count) ) ;
51
51
}
52
+ known. push ( ( ref_name. clone ( ) , junctions_vec) ) ;
52
53
}
53
54
54
55
let mut partial_novel = Vec :: new ( ) ;
55
56
for ( ref_name, junctions) in & self . partial_novel {
57
+ let mut junctions_vec = Vec :: new ( ) ;
56
58
for ( ( start, end) , count) in junctions {
57
- partial_novel . push ( ( ref_name , start. get ( ) , end. get ( ) , count) ) ;
59
+ junctions_vec . push ( ( start. get ( ) , end. get ( ) , count) ) ;
58
60
}
61
+ partial_novel. push ( ( ref_name. clone ( ) , junctions_vec) ) ;
59
62
}
60
63
61
64
let mut complete_novel = Vec :: new ( ) ;
62
65
for ( ref_name, junctions) in & self . complete_novel {
66
+ let mut junctions_vec = Vec :: new ( ) ;
63
67
for ( ( start, end) , count) in junctions {
64
- complete_novel . push ( ( ref_name , start. get ( ) , end. get ( ) , count) ) ;
68
+ junctions_vec . push ( ( start. get ( ) , end. get ( ) , count) ) ;
65
69
}
70
+ complete_novel. push ( ( ref_name. clone ( ) , junctions_vec) ) ;
66
71
}
67
72
68
73
let mut unannotated_reference = Vec :: new ( ) ;
69
74
for ( ref_name, junctions) in & self . unannotated_reference {
75
+ let mut junctions_vec = Vec :: new ( ) ;
70
76
for ( ( start, end) , count) in junctions {
71
- unannotated_reference . push ( ( ref_name , start. get ( ) , end. get ( ) , count) ) ;
77
+ junctions_vec . push ( ( start. get ( ) , end. get ( ) , count) ) ;
72
78
}
79
+ unannotated_reference. push ( ( ref_name. clone ( ) , junctions_vec) ) ;
73
80
}
74
81
75
82
let mut s = serializer. serialize_struct ( "JunctionAnnotations" , 4 ) ?;
0 commit comments