pub struct BuiltinTypeDef {
pub name: &'static str,
pub fields: &'static [BuiltinField],
pub is_copy: bool,
pub drop_fn: Option<&'static str>,
pub operators: &'static [BuiltinOperator],
pub associated_fns: &'static [BuiltinAssociatedFn],
pub methods: &'static [BuiltinMethod],
}Expand description
Definition of a built-in type.
This describes everything the compiler needs to know about a built-in type: its layout (fields), behavior (operators), and available operations (methods).
Fields§
§name: &'static strType name as it appears in source code (e.g., “String”)
fields: &'static [BuiltinField]Fields that make up the struct layout
is_copy: boolWhether this type is Copy (can be implicitly duplicated)
drop_fn: Option<&'static str>Runtime function to call for drop, if any
operators: &'static [BuiltinOperator]Supported operators and their implementations
associated_fns: &'static [BuiltinAssociatedFn]Associated functions (e.g., String::new)
methods: &'static [BuiltinMethod]Instance methods (e.g., s.len())
Implementations§
Source§impl BuiltinTypeDef
impl BuiltinTypeDef
Sourcepub fn slot_count(&self) -> u32
pub fn slot_count(&self) -> u32
Get the number of slots this type uses in the ABI.
Each field uses one slot (all fields are currently scalar types).
Sourcepub fn find_associated_fn(&self, name: &str) -> Option<&BuiltinAssociatedFn>
pub fn find_associated_fn(&self, name: &str) -> Option<&BuiltinAssociatedFn>
Find an associated function by name.
Sourcepub fn find_method(&self, name: &str) -> Option<&BuiltinMethod>
pub fn find_method(&self, name: &str) -> Option<&BuiltinMethod>
Find a method by name.
Sourcepub fn find_operator(&self, op: BinOp) -> Option<&BuiltinOperator>
pub fn find_operator(&self, op: BinOp) -> Option<&BuiltinOperator>
Find an operator implementation.
Sourcepub fn supports_operator(&self, op: BinOp) -> bool
pub fn supports_operator(&self, op: BinOp) -> bool
Check if this type supports a given operator.
Trait Implementations§
Source§impl Clone for BuiltinTypeDef
impl Clone for BuiltinTypeDef
Source§fn clone(&self) -> BuiltinTypeDef
fn clone(&self) -> BuiltinTypeDef
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BuiltinTypeDef
impl RefUnwindSafe for BuiltinTypeDef
impl Send for BuiltinTypeDef
impl Sync for BuiltinTypeDef
impl Unpin for BuiltinTypeDef
impl UnwindSafe for BuiltinTypeDef
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more