TypeInfo

Enum TypeInfo 

Source
pub enum TypeInfo {
    BaseType {
        name: String,
        size: u64,
        encoding: u16,
    },
    PointerType {
        target_type: Box<TypeInfo>,
        size: u64,
    },
    ArrayType {
        element_type: Box<TypeInfo>,
        element_count: Option<u64>,
        total_size: Option<u64>,
    },
    StructType {
        name: String,
        size: u64,
        members: Vec<StructMember>,
    },
    UnionType {
        name: String,
        size: u64,
        members: Vec<StructMember>,
    },
    EnumType {
        name: String,
        size: u64,
        base_type: Box<TypeInfo>,
        variants: Vec<EnumVariant>,
    },
    TypedefType {
        name: String,
        underlying_type: Box<TypeInfo>,
    },
    QualifiedType {
        qualifier: TypeQualifier,
        underlying_type: Box<TypeInfo>,
    },
    FunctionType {
        return_type: Option<Box<TypeInfo>>,
        parameters: Vec<TypeInfo>,
    },
    BitfieldType {
        underlying_type: Box<TypeInfo>,
        bit_offset: u8,
        bit_size: u8,
    },
    UnknownType {
        name: String,
    },
    OptimizedOut {
        name: String,
    },
}
Expand description

Type information with full fidelity from DWARF debugging data

Variants§

§

BaseType

Base/primitive type (int, float, char, etc.)

Fields

§name: String
§size: u64
§encoding: u16
§

PointerType

Pointer type

Fields

§target_type: Box<TypeInfo>
§size: u64
§

ArrayType

Array type

Fields

§element_type: Box<TypeInfo>
§element_count: Option<u64>
§total_size: Option<u64>
§

StructType

Struct/class type

Fields

§name: String
§size: u64
§

UnionType

Union type

Fields

§name: String
§size: u64
§

EnumType

Enum type

Fields

§name: String
§size: u64
§base_type: Box<TypeInfo>
§variants: Vec<EnumVariant>
§

TypedefType

Typedef (type alias)

Fields

§name: String
§underlying_type: Box<TypeInfo>
§

QualifiedType

Qualified type (const, volatile, restrict)

Fields

§qualifier: TypeQualifier
§underlying_type: Box<TypeInfo>
§

FunctionType

Function type

Fields

§return_type: Option<Box<TypeInfo>>
§parameters: Vec<TypeInfo>
§

BitfieldType

Bitfield type: a view over an underlying integer type with bit offset/size

Fields

§underlying_type: Box<TypeInfo>
§bit_offset: u8
§bit_size: u8
§

UnknownType

Unresolved or unknown type

Fields

§name: String
§

OptimizedOut

Optimized out type (variable was optimized away by compiler)

Fields

§name: String

Implementations§

Source§

impl TypeInfo

Source

pub fn size(&self) -> u64

Get the size in bytes of this type

Source

pub fn type_name(&self) -> String

Get the type name for display

Source

pub fn is_signed_int(&self) -> bool

Check if this is a signed integer type

Source

pub fn is_unsigned_int(&self) -> bool

Check if this is an unsigned integer type

Source

pub fn is_float(&self) -> bool

Check if this is a floating point type

Source

pub fn is_pointer(&self) -> bool

Check if this is a pointer type

Source

pub fn is_array(&self) -> bool

Check if this is an array type

Source

pub fn underlying_type(&self) -> &TypeInfo

Get the underlying type, skipping typedefs and qualifiers

Source

pub fn signed_int(size: u64) -> Self

Create a signed integer base type (compatibility method for compiler)

Source

pub fn float(size: u64) -> Self

Create a floating point base type (compatibility method for compiler)

Trait Implementations§

Source§

impl Clone for TypeInfo

Source§

fn clone(&self) -> TypeInfo

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TypeInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TypeInfo

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for TypeInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&TypeInfo> for TypeKind

Source§

fn from(type_info: &TypeInfo) -> Self

Convert TypeInfo to TypeKind for runtime classification

Source§

impl PartialEq for TypeInfo

Source§

fn eq(&self, other: &TypeInfo) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for TypeInfo

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for TypeInfo

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,