1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
use std::collections::HashMap; use super::{BasicType, BasicTypeBase, TypeHandle, TypeKind}; pub type TupleStructType = BasicType<TupleStructImpl>; pub struct TupleStructImpl { name: Box<str>, element_types: Vec<TypeHandle>, } impl TupleStructType { pub fn new(name: impl Into<Box<str>>, element_types: impl Into<Vec<TypeHandle>>) -> Self { let (name, element_types) = (name.into(), element_types.into()); Self::from_base(TupleStructImpl { name, element_types }) } } impl BasicTypeBase for TupleStructImpl { fn name(&self) -> &str { &self.name } fn kind(&self) -> TypeKind { TypeKind::TupleStruct } fn fields(&self) -> (Option<&HashMap<Box<str>, usize>>, &[TypeHandle]) { (None, &self.element_types) } }