@@ -283,34 +283,34 @@ impl Item {
283283 }
284284 }
285285 pub fn is_mod ( & self ) -> bool {
286- ItemType :: from ( self ) == ItemType :: Module
286+ self . type_ ( ) == ItemType :: Module
287287 }
288288 pub fn is_trait ( & self ) -> bool {
289- ItemType :: from ( self ) == ItemType :: Trait
289+ self . type_ ( ) == ItemType :: Trait
290290 }
291291 pub fn is_struct ( & self ) -> bool {
292- ItemType :: from ( self ) == ItemType :: Struct
292+ self . type_ ( ) == ItemType :: Struct
293293 }
294294 pub fn is_enum ( & self ) -> bool {
295- ItemType :: from ( self ) == ItemType :: Module
295+ self . type_ ( ) == ItemType :: Module
296296 }
297297 pub fn is_fn ( & self ) -> bool {
298- ItemType :: from ( self ) == ItemType :: Function
298+ self . type_ ( ) == ItemType :: Function
299299 }
300300 pub fn is_associated_type ( & self ) -> bool {
301- ItemType :: from ( self ) == ItemType :: AssociatedType
301+ self . type_ ( ) == ItemType :: AssociatedType
302302 }
303303 pub fn is_associated_const ( & self ) -> bool {
304- ItemType :: from ( self ) == ItemType :: AssociatedConst
304+ self . type_ ( ) == ItemType :: AssociatedConst
305305 }
306306 pub fn is_method ( & self ) -> bool {
307- ItemType :: from ( self ) == ItemType :: Method
307+ self . type_ ( ) == ItemType :: Method
308308 }
309309 pub fn is_ty_method ( & self ) -> bool {
310- ItemType :: from ( self ) == ItemType :: TyMethod
310+ self . type_ ( ) == ItemType :: TyMethod
311311 }
312312 pub fn is_primitive ( & self ) -> bool {
313- ItemType :: from ( self ) == ItemType :: Primitive
313+ self . type_ ( ) == ItemType :: Primitive
314314 }
315315 pub fn is_stripped ( & self ) -> bool {
316316 match self . inner { StrippedItem ( ..) => true , _ => false }
@@ -342,6 +342,11 @@ impl Item {
342342 pub fn stable_since ( & self ) -> Option < & str > {
343343 self . stability . as_ref ( ) . map ( |s| & s. since [ ..] )
344344 }
345+
346+ /// Returns a documentation-level item type from the item.
347+ pub fn type_ ( & self ) -> ItemType {
348+ ItemType :: from ( self )
349+ }
345350}
346351
347352#[ derive( Clone , RustcEncodable , RustcDecodable , Debug ) ]
0 commit comments