diff options
Diffstat (limited to 'src/libsyntax/ast.rs')
| -rw-r--r-- | src/libsyntax/ast.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 9c3960d0f06..2f5459b6f2e 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1053,6 +1053,15 @@ pub struct StructField_ { pub attrs: Vec<Attribute>, } +impl StructField_ { + pub fn ident(&self) -> Option<Ident> { + match self.kind { + NamedField(ref ident, _) => Some(ident.clone()), + UnnamedField(_) => None + } + } +} + pub type StructField = Spanned<StructField_>; #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] |
