pub struct Type<'tu> { /* private fields */ }
Expand description
The type of an AST entity.
Implementations
sourceimpl<'tu> Type<'tu>
impl<'tu> Type<'tu>
sourcepub fn get_display_name(&self) -> String
pub fn get_display_name(&self) -> String
Returns the display name of this type.
sourcepub fn get_alignof(&self) -> Result<usize, AlignofError>
pub fn get_alignof(&self) -> Result<usize, AlignofError>
Returns the alignment of this type in bytes.
Failures
- this type is a dependent type
- this type is an incomplete type
sourcepub fn get_offsetof<F: AsRef<str>>(
&self,
field: F
) -> Result<usize, OffsetofError>
pub fn get_offsetof<F: AsRef<str>>(
&self,
field: F
) -> Result<usize, OffsetofError>
Returns the offset of the field with the supplied name in this record type in bits.
Failures
- this record type is a dependent type
- this record record type is an incomplete type
- this record type does not contain a field with the supplied name
sourcepub fn get_sizeof(&self) -> Result<usize, SizeofError>
pub fn get_sizeof(&self) -> Result<usize, SizeofError>
Returns the size of this type in bytes.
Failures
- this type is a dependent type
- this type is an incomplete type
- this type is a variable size type
sourcepub fn get_address_space(&self) -> usize
pub fn get_address_space(&self) -> usize
Returns the address space of this type.
sourcepub fn get_argument_types(&self) -> Option<Vec<Type<'tu>>>
pub fn get_argument_types(&self) -> Option<Vec<Type<'tu>>>
Returns the argument types for this function or method type, if applicable.
sourcepub fn get_calling_convention(&self) -> Option<CallingConvention>
pub fn get_calling_convention(&self) -> Option<CallingConvention>
Returns the calling convention specified for this function type, if applicable.
sourcepub fn get_canonical_type(&self) -> Type<'tu>
pub fn get_canonical_type(&self) -> Type<'tu>
Returns the canonical type for this type.
The canonical type is the underlying type with all “sugar” removed (e.g., typedefs).
sourcepub fn get_class_type(&self) -> Option<Type<'tu>>
pub fn get_class_type(&self) -> Option<Type<'tu>>
Returns the class type for this member pointer type, if applicable.
sourcepub fn get_declaration(&self) -> Option<Entity<'tu>>
pub fn get_declaration(&self) -> Option<Entity<'tu>>
Returns the AST entity that declared this type, if any.
sourcepub fn get_elaborated_type(&self) -> Option<Type<'tu>>
pub fn get_elaborated_type(&self) -> Option<Type<'tu>>
Returns the type named by this elaborated type, if applicable.
sourcepub fn get_element_type(&self) -> Option<Type<'tu>>
pub fn get_element_type(&self) -> Option<Type<'tu>>
Returns the element type for this array, complex, or vector type, if applicable.
sourcepub fn get_exception_specification(&self) -> Option<ExceptionSpecification>
pub fn get_exception_specification(&self) -> Option<ExceptionSpecification>
Returns the exception specification of this type, if applicable.
sourcepub fn get_fields(&self) -> Option<Vec<Entity<'tu>>>
pub fn get_fields(&self) -> Option<Vec<Entity<'tu>>>
Returns the fields in this record type, if applicable.
sourcepub fn get_modified_type(&self) -> Option<Type<'tu>>
pub fn get_modified_type(&self) -> Option<Type<'tu>>
Return the type that was modified by this attributed type.
sourcepub fn get_nullability(&self) -> Option<Nullability>
pub fn get_nullability(&self) -> Option<Nullability>
Returns the nullability of this pointer type, if applicable.
sourcepub fn get_objc_encoding(&self) -> Option<String>
pub fn get_objc_encoding(&self) -> Option<String>
Returns the encoding of this Objective-C type, if applicable.
sourcepub fn get_objc_object_base_type(&self) -> Option<Type<'_>>
pub fn get_objc_object_base_type(&self) -> Option<Type<'_>>
Returns the base type of this Objective-C type, if applicable.
sourcepub fn get_objc_protocol_declarations(&self) -> Vec<Entity<'tu>>
pub fn get_objc_protocol_declarations(&self) -> Vec<Entity<'tu>>
Returns the declarations for all protocol references for this Objective-C type, if applicable.
sourcepub fn get_objc_type_arguments(&self) -> Vec<Type<'tu>>
pub fn get_objc_type_arguments(&self) -> Vec<Type<'tu>>
Returns the type arguments for this Objective-C type, if applicable.
sourcepub fn get_pointee_type(&self) -> Option<Type<'tu>>
pub fn get_pointee_type(&self) -> Option<Type<'tu>>
Returns the pointee type for this pointer type, if applicable.
sourcepub fn get_ref_qualifier(&self) -> Option<RefQualifier>
pub fn get_ref_qualifier(&self) -> Option<RefQualifier>
Returns the ref qualifier for this C++ function or method type, if applicable.
sourcepub fn get_result_type(&self) -> Option<Type<'tu>>
pub fn get_result_type(&self) -> Option<Type<'tu>>
Returns the result type for this function or method type, if applicable.
sourcepub fn get_size(&self) -> Option<usize>
pub fn get_size(&self) -> Option<usize>
Returns the size of this constant array or vector type, if applicable.
sourcepub fn get_template_argument_types(&self) -> Option<Vec<Option<Type<'tu>>>>
pub fn get_template_argument_types(&self) -> Option<Vec<Option<Type<'tu>>>>
Returns the template argument types for this template class specialization type, if applicable.
sourcepub fn get_typedef_name(&self) -> Option<String>
pub fn get_typedef_name(&self) -> Option<String>
Returns the typedef name of this type, if applicable.
sourcepub fn is_const_qualified(&self) -> bool
pub fn is_const_qualified(&self) -> bool
Returns whether this type is qualified with const.
sourcepub fn is_elaborated(&self) -> Option<bool>
pub fn is_elaborated(&self) -> Option<bool>
Returns whether this type is an elaborated type, if it can be determined for certain.
sourcepub fn is_restrict_qualified(&self) -> bool
pub fn is_restrict_qualified(&self) -> bool
Returns whether this type is qualified with restrict.
sourcepub fn is_transparent_tag(&self) -> bool
pub fn is_transparent_tag(&self) -> bool
Returns whether this type is a transparent tag typedef.
sourcepub fn is_variadic(&self) -> bool
pub fn is_variadic(&self) -> bool
Returns whether this type is a variadic function type.
sourcepub fn is_volatile_qualified(&self) -> bool
pub fn is_volatile_qualified(&self) -> bool
Returns whether this type is qualified with volatile.
sourcepub fn visit_fields<F: FnMut(Entity<'tu>) -> bool>(&self, f: F) -> Option<bool>
pub fn visit_fields<F: FnMut(Entity<'tu>) -> bool>(&self, f: F) -> Option<bool>
Visits the fields in this record type, returning None
if this type is not a record type
and returning Some(b)
otherwise where b
indicates whether visitation was ended by the
callback returning false
.
sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Returns whether this type is an integer type.
sourcepub fn is_signed_integer(&self) -> bool
pub fn is_signed_integer(&self) -> bool
Returns whether this type is a signed integer type.
sourcepub fn is_unsigned_integer(&self) -> bool
pub fn is_unsigned_integer(&self) -> bool
Returns whether this type is an unsigned integer type.
Trait Implementations
impl<'tu> Copy for Type<'tu>
impl<'tu> Eq for Type<'tu>
Auto Trait Implementations
impl<'tu> RefUnwindSafe for Type<'tu>
impl<'tu> !Send for Type<'tu>
impl<'tu> !Sync for Type<'tu>
impl<'tu> Unpin for Type<'tu>
impl<'tu> UnwindSafe for Type<'tu>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more