1
Fork 0

rustdoc: Render associated type bindings

e.g. `Foo<Output=A>`

This does not work cross-crate unfortunately.

Part of #20646
This commit is contained in:
Tom Jakubowski 2015-01-07 16:10:40 -08:00
parent 9f1ead8fad
commit a0734ff7e0
2 changed files with 48 additions and 4 deletions

View file

@ -250,8 +250,10 @@ impl fmt::Show for clean::PathParameters {
impl fmt::String for clean::PathParameters {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
clean::PathParameters::AngleBracketed { ref lifetimes, ref types } => {
if lifetimes.len() > 0 || types.len() > 0 {
clean::PathParameters::AngleBracketed {
ref lifetimes, ref types, ref bindings
} => {
if lifetimes.len() > 0 || types.len() > 0 || bindings.len() > 0 {
try!(f.write_str("&lt;"));
let mut comma = false;
for lifetime in lifetimes.iter() {
@ -268,6 +270,13 @@ impl fmt::String for clean::PathParameters {
comma = true;
try!(write!(f, "{}", *ty));
}
for binding in bindings.iter() {
if comma {
try!(f.write_str(", "));
}
comma = true;
try!(write!(f, "{}", *binding));
}
try!(f.write_str("&gt;"));
}
}
@ -855,6 +864,7 @@ impl fmt::String for clean::ViewListIdent {
params: clean::PathParameters::AngleBracketed {
lifetimes: Vec::new(),
types: Vec::new(),
bindings: Vec::new()
}
})
};
@ -865,6 +875,19 @@ impl fmt::String for clean::ViewListIdent {
}
}
//NOTE(stage0): remove impl after snapshot
impl fmt::Show for clean::TypeBinding {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt(self, f)
}
}
impl fmt::String for clean::TypeBinding {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}={}", self.name, self.ty)
}
}
//NOTE(stage0): remove impl after snapshot
#[cfg(stage0)]
impl fmt::Show for MutableSpace {