File tree 2 files changed +20
-0
lines changed 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -331,6 +331,12 @@ impl Item {
331
331
self . kind ( ) . expect_type ( )
332
332
}
333
333
334
+ /// Get a reference to this item's underlying `Type`, or `None` if this is
335
+ /// some other kind of item.
336
+ pub fn as_type ( & self ) -> Option < & Type > {
337
+ self . kind ( ) . as_type ( )
338
+ }
339
+
334
340
/// Get a reference to this item's underlying `Function`. Panic if this is
335
341
/// some other kind of item.
336
342
pub fn expect_function ( & self ) -> & Function {
@@ -531,6 +537,11 @@ impl Item {
531
537
ctx. opaque_by_name ( & self . real_canonical_name ( ctx, false , true ) )
532
538
}
533
539
540
+ /// Is this a reference to another type?
541
+ pub fn is_type_ref ( & self ) -> bool {
542
+ self . as_type ( ) . map_or ( false , |ty| ty. is_type_ref ( ) )
543
+ }
544
+
534
545
/// Get the canonical name without taking into account the replaces
535
546
/// annotation.
536
547
///
Original file line number Diff line number Diff line change @@ -136,6 +136,15 @@ impl Type {
136
136
self . is_const
137
137
}
138
138
139
+ /// Is this a reference to another type?
140
+ pub fn is_type_ref ( & self ) -> bool {
141
+ match self . kind {
142
+ TypeKind :: ResolvedTypeRef ( _) |
143
+ TypeKind :: UnresolvedTypeRef ( _, _, _) => true ,
144
+ _ => false ,
145
+ }
146
+ }
147
+
139
148
/// What is the layout of this type?
140
149
pub fn layout ( & self , ctx : & BindgenContext ) -> Option < Layout > {
141
150
use std:: mem;
You can’t perform that action at this time.
0 commit comments