pub struct StructDef {
pub name: String,
pub fields: Vec<StructField>,
pub is_copy: bool,
pub is_handle: bool,
pub is_linear: bool,
pub destructor: Option<String>,
pub is_builtin: bool,
pub is_pub: bool,
pub file_id: FileId,
}Expand description
Definition of a struct type.
Fields§
§name: StringStruct name
fields: Vec<StructField>Fields in declaration order
is_copy: boolWhether this struct is marked with @copy (can be implicitly duplicated)
is_handle: boolWhether this struct is marked with @handle (can be explicitly duplicated via .handle())
is_linear: boolWhether this struct is a linear type (must be consumed, cannot be dropped)
destructor: Option<String>User-defined destructor function name, if any (e.g., “Data.__drop”)
is_builtin: boolWhether this is a built-in type (e.g., String) injected by the compiler.
Built-in types behave like regular structs but have runtime implementations for their methods rather than generated code.
is_pub: boolWhether this struct is public (visible outside its directory)
file_id: FileIdFile ID this struct was declared in (for visibility checking)
Implementations§
Source§impl StructDef
impl StructDef
Sourcepub fn find_field(&self, name: &str) -> Option<(usize, &StructField)>
pub fn find_field(&self, name: &str) -> Option<(usize, &StructField)>
Find a field by name and return its index and definition.
Sourcepub fn field_count(&self) -> usize
pub fn field_count(&self) -> usize
Get the number of fields in this struct.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StructDef
impl RefUnwindSafe for StructDef
impl Send for StructDef
impl Sync for StructDef
impl Unpin for StructDef
impl UnwindSafe for StructDef
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
§fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
MaybeRef].