@@ -663,31 +663,27 @@ impl fmt::Show for ModuleSummary {
663
663
context. push ( m. name . as_slice ( ) ) ;
664
664
let path = context. connect ( "::" ) ;
665
665
666
- // the total width of each row's stability summary, in pixels
667
- let width = 500 ;
668
-
669
666
try!( write ! ( f, "<tr>" ) ) ;
670
- try!( write ! ( f, "<td class='summary'>\
671
- <a class='summary' href='{}'>{}</a></td>",
667
+ try!( write ! ( f, "<td><a href='{}'>{}</a></td>" ,
672
668
Vec :: from_slice( context. slice_from( 1 ) )
673
669
. append_one( "index.html" ) . connect( "/" ) ,
674
670
path) ) ;
675
- try!( write ! ( f, "<td>" ) ) ;
671
+ try!( write ! ( f, "<td class='summary-column' >" ) ) ;
676
672
try!( write ! ( f, "<span class='summary Stable' \
677
- style='width: {}px ; display: inline-block'> </span>",
678
- ( width * cnt. stable) /tot) ) ;
673
+ style='width: {:.4}% ; display: inline-block'> </span>",
674
+ ( 100 * cnt. stable) as f64 /tot as f64 ) ) ;
679
675
try!( write ! ( f, "<span class='summary Unstable' \
680
- style='width: {}px ; display: inline-block'> </span>",
681
- ( width * cnt. unstable) /tot) ) ;
676
+ style='width: {:.4}% ; display: inline-block'> </span>",
677
+ ( 100 * cnt. unstable) as f64 /tot as f64 ) ) ;
682
678
try!( write ! ( f, "<span class='summary Experimental' \
683
- style='width: {}px ; display: inline-block'> </span>",
684
- ( width * cnt. experimental) /tot) ) ;
679
+ style='width: {:.4}% ; display: inline-block'> </span>",
680
+ ( 100 * cnt. experimental) as f64 /tot as f64 ) ) ;
685
681
try!( write ! ( f, "<span class='summary Deprecated' \
686
- style='width: {}px ; display: inline-block'> </span>",
687
- ( width * cnt. deprecated) /tot) ) ;
682
+ style='width: {:.4}% ; display: inline-block'> </span>",
683
+ ( 100 * cnt. deprecated) as f64 /tot as f64 ) ) ;
688
684
try!( write ! ( f, "<span class='summary Unmarked' \
689
- style='width: {}px ; display: inline-block'> </span>",
690
- ( width * cnt. unmarked) /tot) ) ;
685
+ style='width: {:.4}% ; display: inline-block'> </span>",
686
+ ( 100 * cnt. unmarked) as f64 /tot as f64 ) ) ;
691
687
try!( write ! ( f, "</td></tr>" ) ) ;
692
688
693
689
for submodule in m. submodules . iter ( ) {
@@ -699,20 +695,33 @@ impl fmt::Show for ModuleSummary {
699
695
700
696
let mut context = Vec :: new ( ) ;
701
697
698
+ let tot = self . counts . total ( ) ;
699
+ let ( stable, unstable, experimental, deprecated, unmarked) = if tot == 0 {
700
+ ( 0 , 0 , 0 , 0 , 0 )
701
+ } else {
702
+ ( ( 100 * self . counts . stable ) /tot,
703
+ ( 100 * self . counts . unstable ) /tot,
704
+ ( 100 * self . counts . experimental ) /tot,
705
+ ( 100 * self . counts . deprecated ) /tot,
706
+ ( 100 * self . counts . unmarked ) /tot)
707
+ } ;
708
+
702
709
try!( write ! ( f,
703
- r"<h1 class='fqn'>Stability dashboard: crate <a class='mod' href='index.html'>{}</a></h1>
710
+ r"<h1 class='fqn'>Stability dashboard: crate <a class='mod' href='index.html'>{name }</a></h1>
704
711
This dashboard summarizes the stability levels for all of the public modules of
705
- the crate, according to the total number of items at each level in the module and its children:
712
+ the crate, according to the total number of items at each level in the module and
713
+ its children (percentages total for {name}):
706
714
<blockquote>
707
- <a class='stability Stable'></a> stable,<br/>
708
- <a class='stability Unstable'></a> unstable,<br/>
709
- <a class='stability Experimental'></a> experimental,<br/>
710
- <a class='stability Deprecated'></a> deprecated,<br/>
711
- <a class='stability Unmarked'></a> unmarked
715
+ <a class='stability Stable'></a> stable ({}%) ,<br/>
716
+ <a class='stability Unstable'></a> unstable ({}%) ,<br/>
717
+ <a class='stability Experimental'></a> experimental ({}%) ,<br/>
718
+ <a class='stability Deprecated'></a> deprecated ({}%) ,<br/>
719
+ <a class='stability Unmarked'></a> unmarked ({}%)
712
720
</blockquote>
713
721
The counts do not include methods or trait
714
722
implementations that are visible only through a re-exported type." ,
715
- self . name) ) ;
723
+ stable, unstable, experimental, deprecated, unmarked,
724
+ name=self . name) ) ;
716
725
try!( write ! ( f, "<table>" ) )
717
726
try!( fmt_inner ( f, & mut context, self ) ) ;
718
727
write ! ( f, "</table>" )
0 commit comments