abi_stable/prefix_type/
layout.rs1use crate::{std_types::RStr, type_layout::MonoTypeLayout};
2
3#[repr(C)]
5#[derive(Debug, Copy, Clone, StableAbi)]
6pub struct PTStructLayout {
8 pub generics: RStr<'static>,
10 pub mono_layout: &'static MonoTypeLayout,
12}
13
14impl PTStructLayout {
17 pub const fn new(generics: RStr<'static>, mono_layout: &'static MonoTypeLayout) -> Self {
19 Self {
20 generics,
21 mono_layout,
22 }
23 }
24
25 #[inline]
27 pub fn get_field_names(&self) -> impl Iterator<Item = &'static str> {
28 self.mono_layout.field_names()
29 }
30
31 #[inline]
33 pub fn get_field_names_vec(&self) -> Vec<&'static str> {
34 self.mono_layout.field_names().collect()
35 }
36
37 #[inline]
39 pub fn get_field_name(&self, ith: usize) -> Option<&'static str> {
40 self.mono_layout.get_field_name(ith)
41 }
42}