1
Fork 0

Add a header method to FnKind

This commit is contained in:
varkor 2019-04-18 18:44:55 +01:00
parent 4530c528ba
commit c0ad4b0a96

View file

@ -57,6 +57,14 @@ impl<'a> FnKind<'a> {
FnKind::Closure(attrs) => attrs, FnKind::Closure(attrs) => attrs,
} }
} }
pub fn header(&self) -> Option<FnHeader> {
match *self {
FnKind::ItemFn(_, _, header, _, _) => Some(header),
FnKind::Method(_, sig, _, _) => Some(sig.header),
FnKind::Closure(_) => None,
}
}
} }
/// Specifies what nested things a visitor wants to visit. The most /// Specifies what nested things a visitor wants to visit. The most