pub struct CommaSep<'a, T: 'a>(pub &'a [T]);
pub struct AbiSpace(pub Abi);
+pub struct HRef<'a> {
+ pub did: DefId,
+ pub text: &'a str,
+}
+
impl<'a> VisSpace<'a> {
pub fn get(self) -> &'a Option<clean::Visibility> {
let VisSpace(v) = self; v
}
}
}
-
- match href(did) {
- Some((url, shortty, fqp)) => {
- write!(w, "<a class='{}' href='{}' title='{}'>{}</a>",
- shortty, url, fqp.join("::"), last.name)?;
- }
- _ => write!(w, "{}", last.name)?,
- }
- write!(w, "{}", last.params)?;
+ write!(w, "{}{}", HRef::new(did, &last.name), last.params)?;
Ok(())
}
}
}
+impl<'a> HRef<'a> {
+ pub fn new(did: DefId, text: &'a str) -> HRef<'a> {
+ HRef { did: did, text: text }
+ }
+}
+
+impl<'a> fmt::Display for HRef<'a> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ match href(self.did) {
+ Some((url, shortty, fqp)) => {
+ write!(f, "<a class='{}' href='{}' title='{}'>{}</a>",
+ shortty, url, fqp.join("::"), self.text)
+ }
+ _ => write!(f, "{}", self.text),
+ }
+ }
+}
+
impl fmt::Display for clean::Type {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {