Struct llvm_rs::types::StructType
source · pub struct StructType(_);Expand description
A structure type, such as a tuple or struct.
Implementations§
source§impl StructType
impl StructType
sourcepub fn new<'a>(
context: &'a Context,
fields: &[&'a Type],
packed: bool
) -> &'a StructType
pub fn new<'a>(
context: &'a Context,
fields: &[&'a Type],
packed: bool
) -> &'a StructType
Make a new struct with the given fields and packed representation.
sourcepub fn new_named<'a>(
context: &'a Context,
name: &str,
fields: &[&'a Type],
packed: bool
) -> &'a StructType
pub fn new_named<'a>(
context: &'a Context,
name: &str,
fields: &[&'a Type],
packed: bool
) -> &'a StructType
Make a new named struct with the given fields and packed representation.
sourcepub fn new_opaque<'a>(context: &'a Context, name: &str) -> &'a StructType
pub fn new_opaque<'a>(context: &'a Context, name: &str) -> &'a StructType
Make a new named struct without defining its fields yet.
You can use this opaque struct without defining its fields (for creating recursive types, etc.). When you want to define its fields (which may include itself), use set_elements().
sourcepub fn set_elements<'a>(
&self,
fields: &[&'a Type],
packed: bool
) -> Result<(), ()>
pub fn set_elements<'a>(
&self,
fields: &[&'a Type],
packed: bool
) -> Result<(), ()>
Set the elements that make up this struct.
Can only be called once, and only on a StructType created through the new_opaque() function. Returns Err(()) if the struct is not opaque.
sourcepub fn get_elements(&self) -> Vec<&Type>
pub fn get_elements(&self) -> Vec<&Type>
Returns the elements that make up this struct.
Methods from Deref<Target = Type>§
sourcepub fn is_sized(&self) -> bool
pub fn is_sized(&self) -> bool
Returns true if the size of the type is known at compile-time.
This is equivalent to the type implementing Sized in Rust
sourcepub fn is_function(&self) -> bool
pub fn is_function(&self) -> bool
Returns true if this type is a function.
This is equivalent to FunctionType::is.
sourcepub fn is_struct(&self) -> bool
pub fn is_struct(&self) -> bool
Returns true if this type is a struct.
This is equivalent to StructType::is.
sourcepub fn is_pointer(&self) -> bool
pub fn is_pointer(&self) -> bool
Returns true if this type is a pointer.
This is equivalent to PointerType::is.
sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Returns true if this type is an integer.