pub struct TypeInfo {
pub base_type: String,
pub is_const: bool,
pub is_volatile: bool,
pub is_struct: bool,
pub is_union: bool,
pub pointer_depth: usize,
pub location: SourceLocation,
pub auto_cleanup: Option<AutoCleanupMacro>,
}Fields§
§base_type: StringBase type without qualifiers or pointers: "GFile", "int".
is_const: bool§is_volatile: bool§is_struct: boolTrue when spelled with the struct keyword (struct Foo *).
is_union: boolTrue when spelled with the union keyword (union Foo *).
pointer_depth: usizePointer indirections: 0 = value, 1 = *, 2 = **.
location: SourceLocation§auto_cleanup: Option<AutoCleanupMacro>Implementations§
Source§impl TypeInfo
impl TypeInfo
pub fn new(type_string: &str, location: SourceLocation) -> Self
Sourcepub fn is_pointer(&self) -> bool
pub fn is_pointer(&self) -> bool
Check if this is a pointer type (at least one level of indirection)
Sourcepub fn base_type_name(&self) -> &str
pub fn base_type_name(&self) -> &str
Get the base type without any qualifiers or pointers
Sourcepub fn is_base_type(&self, name: &str) -> bool
pub fn is_base_type(&self, name: &str) -> bool
Check if the base type matches the given name
Sourcepub fn display_name(&self) -> String
pub fn display_name(&self) -> String
Human-readable type string reconstructed from structured fields,
e.g. "const char *".
Sourcepub fn uses_auto_cleanup(&self) -> bool
pub fn uses_auto_cleanup(&self) -> bool
Check if the type uses any auto-cleanup macro (g_autoptr, g_autofree, g_autolist, etc.)
Sourcepub fn normalized_base_type(&self) -> &str
pub fn normalized_base_type(&self) -> &str
GLib C aliases normalised to their C equivalents (gint → int).
Sourcepub fn matches(&self, other: &Self) -> bool
pub fn matches(&self, other: &Self) -> bool
Return true if self and other represent the same type, treating
GLib C aliases as equivalent to their underlying C types.
Sourcepub fn as_basic(&self) -> Option<BasicType>
pub fn as_basic(&self) -> Option<BasicType>
Returns the BasicType if this C type is a primitive scalar.
Handles GLib names (gint), C equivalents (int), C99 fixed-width
types (int32_t), and C99 types (long long, _Bool).
gchar * / char * at pointer_depth 1 maps to BasicType::String.