pub fn create_named_struct_type(
        &self,
        context: &mut Context,
        name: &str,
        elements: &[(&str, Type, Option<Location>)],
        location: Option<Location>,
    ) -> Type {
        let name = context.get_name(name);

        let vec = elements
            .iter()
            .map(|(n, t, l)| (context.get_name(n), *t, *l))
            .collect();

        let ty = Type(
            context
                .types
                .insert(TypePayload::NamedStruct(*self, name, vec, location)),
        );

        context.modules[self.0].named_structs.push(ty);

        ty
    }
/// Get a named struct type.
///
/// # Examples
///
/// ```
/// # use yair::*;
/// # let mut context = Context::new();
/// # let u32_ty = context.get_uint_type(32);
/// # let module = context.create_module().build();
/// # let elements = vec![("my_field", u32_ty, None)];
/// # let location = None;
/// let struct_ty = module.create_named_struct_type(&mut context, "my_struct", &elements, location);
/// ```
Get a named struct type.
Get a named struct type .
pub fn create_named_struct_type(
        &self,
        context: &mut Context,
        name: &str,
        elements: &[(&str, Type, Option<Location>)],
        location: Option<Location>,
    ) -> Type {
        let name = context.get_name(name);
        let vec = elements
            .iter()
            .map(|(n, t, l)| (context.get_name(n), *t, *l))
            .collect();
        let ty = Type(
            context
                .types
                .insert(TypePayload::NamedStruct(*self, name, vec, location)),
        );
        context.modules[self.0].named_structs.push(ty);
        ty
    }
pub fn create_named_struct_type ( & self , context : & mut Context , name : & str , elements : & [ ( & str , Type , Option < Location > ) ] , location : Option < Location > , ) -> Type { let name = context . get_name ( name ) ; let vec = elements . iter ( ) . map ( | ( n , t , l ) | ( context . get_name ( n ) , * t , * l ) ) . collect ( ) ; let ty = Type ( context . types . insert ( TypePayload :: NamedStruct ( * self , name , vec , location ) ) , ) ; context . modules [ self . 0 ] . named_structs . push ( ty ) ; ty }
Get a named struct type.
Get a named struct type .
&self
context
&mut Context
name
&str
elements
&[(&str, Type, Option<Location>)]
location
Option<Location>
&self
context
&mut Context
name
&str
elements
&[(&str, Type, Option<Location>)]
location
Option<Location>
examples
None
use yair::*;
None
let mut context = context::new();
None
let u32_ty = context.get_uint_type(32);
None
let module = context.create_module().build();
None
let elements = vec![("my_field", u32_ty, none)];
None
let location = none;
let struct_ty = module.create_named_struct_type(&mut context, "my_struct", &elements, location);
```
let struct_ty = module . create_named_struct_type ( &mut context " my_struct " &elements location ) ; ` ` `