diff options
author | Artem Biryukov <impowski@protonmail.ch> | 2016-12-15 22:43:38 +0300 |
---|---|---|
committer | Artem Biryukov <impowski@protonmail.ch> | 2016-12-15 22:45:07 +0300 |
commit | 5417d97e3b791048628e0a97897f0f4312c11031 (patch) | |
tree | 3297f5ecb1b27ffe3b01bbecf648720aeaf5d1b2 /libbindgen/src/clang.rs | |
parent | 673cb5ff7555f2c026f4fbb6b8dfac0ff19e8725 (diff) |
Wrap Type into Option
Diffstat (limited to 'libbindgen/src/clang.rs')
-rw-r--r-- | libbindgen/src/clang.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libbindgen/src/clang.rs b/libbindgen/src/clang.rs index 3f272607..192ce09d 100644 --- a/libbindgen/src/clang.rs +++ b/libbindgen/src/clang.rs @@ -402,12 +402,12 @@ impl Cursor { /// Given that this cursor's referent is a `typedef`, get the `Type` that is /// being aliased. - pub fn typedef_type(&self) -> Type { - unsafe { - Type { - x: clang_getTypedefDeclUnderlyingType(self.x), - } - } + pub fn typedef_type(&self) -> Option<Type> { + let inner = Type { + x: unsafe { clang_getTypedefDeclUnderlyingType(self.x) } + }; + + if inner.is_valid() { Some(inner) } else { None } } /// Get the linkage kind for this cursor's referent. |