");
- for meth in i.methods.iter() {
+
+ fn docmeth(w: &mut io::Writer, item: &clean::Item) -> bool {
write!(w, "
\n");
- match meth.doc_value() {
+ match item.doc_value() {
Some(s) => {
write!(w, "
", Markdown(s));
- continue
+ true
}
- None => {}
+ None => false
+ }
+ }
+
+ write!(w, "
");
+ for meth in i.methods.iter() {
+ if docmeth(w, meth) {
+ continue
}
// No documentation? Attempt to slurp in the trait's documentation
@@ -1501,13 +1496,19 @@ fn render_impl(w: &mut io::Writer, i: &clean::Impl, dox: &Option<~str>) {
};
do local_data::get(cache_key) |cache| {
do cache.unwrap().read |cache| {
- let name = meth.name.get_ref().as_slice();
match cache.traits.find(&trait_id) {
- Some(m) => {
- match m.find_equiv(&name) {
- Some(s) => {
- write!(w, "
{}
",
- Markdown(s.as_slice()));
+ Some(t) => {
+ let name = meth.name.clone();
+ match t.methods.iter().find(|t| t.item().name == name) {
+ Some(method) => {
+ match method.item().doc_value() {
+ Some(s) => {
+ write!(w,
+ "
{}
",
+ Markdown(s));
+ }
+ None => {}
+ }
}
None => {}
}
@@ -1517,6 +1518,32 @@ fn render_impl(w: &mut io::Writer, i: &clean::Impl, dox: &Option<~str>) {
}
}
}
+
+ // If we've implemented a trait, then also emit documentation for all
+ // default methods which weren't overridden in the implementation block.
+ match trait_id {
+ None => {}
+ Some(id) => {
+ do local_data::get(cache_key) |cache| {
+ do cache.unwrap().read |cache| {
+ match cache.traits.find(&id) {
+ Some(t) => {
+ for method in t.methods.iter() {
+ let n = method.item().name.clone();
+ match i.methods.iter().find(|m| m.name == n) {
+ Some(*) => continue,
+ None => {}
+ }
+
+ docmeth(w, method.item());
+ }
+ }
+ None => {}
+ }
+ }
+ }
+ }
+ }
write!(w, "