@@ -1787,6 +1787,9 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
1787
1787
let types = t. items . iter ( ) . filter ( |m| {
1788
1788
match m. inner { clean:: AssociatedTypeItem ( ..) => true , _ => false }
1789
1789
} ) . collect :: < Vec < _ > > ( ) ;
1790
+ let consts = t. items . iter ( ) . filter ( |m| {
1791
+ match m. inner { clean:: AssociatedConstItem ( ..) => true , _ => false }
1792
+ } ) . collect :: < Vec < _ > > ( ) ;
1790
1793
let required = t. items . iter ( ) . filter ( |m| {
1791
1794
match m. inner { clean:: TyMethodItem ( _) => true , _ => false }
1792
1795
} ) . collect :: < Vec < _ > > ( ) ;
@@ -1803,7 +1806,15 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
1803
1806
try!( render_assoc_item ( w, t, AssocItemLink :: Anchor ) ) ;
1804
1807
try!( write ! ( w, ";\n " ) ) ;
1805
1808
}
1806
- if !types. is_empty ( ) && !required. is_empty ( ) {
1809
+ if !types. is_empty ( ) && !consts. is_empty ( ) {
1810
+ try!( w. write_str ( "\n " ) ) ;
1811
+ }
1812
+ for t in & consts {
1813
+ try!( write ! ( w, " " ) ) ;
1814
+ try!( render_assoc_item ( w, t, AssocItemLink :: Anchor ) ) ;
1815
+ try!( write ! ( w, ";\n " ) ) ;
1816
+ }
1817
+ if !consts. is_empty ( ) && !required. is_empty ( ) {
1807
1818
try!( w. write_str ( "\n " ) ) ;
1808
1819
}
1809
1820
for m in & required {
@@ -1905,11 +1916,11 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
1905
1916
}
1906
1917
1907
1918
fn assoc_const ( w : & mut fmt:: Formatter , it : & clean:: Item ,
1908
- ty : & clean:: Type , default : & Option < String > )
1919
+ ty : & clean:: Type , default : Option < & String > )
1909
1920
-> fmt:: Result {
1910
1921
try!( write ! ( w, "const {}" , it. name. as_ref( ) . unwrap( ) ) ) ;
1911
1922
try!( write ! ( w, ": {}" , ty) ) ;
1912
- if let Some ( ref default) = * default {
1923
+ if let Some ( default) = default {
1913
1924
try!( write ! ( w, " = {}" , default ) ) ;
1914
1925
}
1915
1926
Ok ( ( ) )
@@ -1971,7 +1982,7 @@ fn render_assoc_item(w: &mut fmt::Formatter, meth: &clean::Item,
1971
1982
link)
1972
1983
}
1973
1984
clean:: AssociatedConstItem ( ref ty, ref default) => {
1974
- assoc_const ( w, meth, ty, default)
1985
+ assoc_const ( w, meth, ty, default. as_ref ( ) )
1975
1986
}
1976
1987
clean:: AssociatedTypeItem ( ref bounds, ref default) => {
1977
1988
assoc_type ( w, meth, bounds, default)
@@ -2335,9 +2346,15 @@ fn render_impl(w: &mut fmt::Formatter, i: &Impl, link: AssocItemLink,
2335
2346
clean:: AssociatedConstItem ( ref ty, ref default) => {
2336
2347
let name = item. name . as_ref ( ) . unwrap ( ) ;
2337
2348
try!( write ! ( w, "<h4 id='assoc_const.{}' class='{}'><code>" ,
2338
- * name,
2339
- shortty( item) ) ) ;
2340
- try!( assoc_const ( w, item, ty, default) ) ;
2349
+ * name, shortty( item) ) ) ;
2350
+ try!( assoc_const ( w, item, ty, default. as_ref ( ) ) ) ;
2351
+ try!( write ! ( w, "</code></h4>\n " ) ) ;
2352
+ }
2353
+ clean:: ConstantItem ( ref c) => {
2354
+ let name = item. name . as_ref ( ) . unwrap ( ) ;
2355
+ try!( write ! ( w, "<h4 id='assoc_const.{}' class='{}'><code>" ,
2356
+ * name, shortty( item) ) ) ;
2357
+ try!( assoc_const ( w, item, & c. type_ , Some ( & c. expr ) ) ) ;
2341
2358
try!( write ! ( w, "</code></h4>\n " ) ) ;
2342
2359
}
2343
2360
clean:: AssociatedTypeItem ( ref bounds, ref default) => {
0 commit comments