pub fn new(
        name: Name,
        units: &[&'t ast::DesignUnit],
        ctx: AllocContext<'t>,
    ) -> Result<&'t Library<'t>> {
        let ctx = ctx.create_subscope();
        let units = units
            .into_iter()
            .flat_map(|unit| -> Option<&'t LatentNode<'t, Node<'t>>> {
                match unit.data {
                    ast::DesignUnitData::PkgDecl(ref decl) => {
                        Some(Package2::alloc_slot(decl, ctx).ok()?)
                    }
                    _ => None,
                }
            })
            .collect();
        let lib = ctx.alloc(Library {
            name: name,
            units: units,
            scope: ctx.scope(),
        });
        ctx.define(
            Spanned::new(get_name_table().intern("WORK", false).into(), INVALID_SPAN),
            Def2::Lib(lib),
        )?;
        Ok(lib)
    }
/// Create a new library of design units.
Create a new library of design units.
Create a new library of design units .
pub fn new(
        name: Name,
        units: &[&'t ast::DesignUnit],
        ctx: AllocContext<'t>,
    ) -> Result<&'t Library<'t>> {
        let ctx = ctx.create_subscope();
        let units = units
            .into_iter()
            .flat_map(|unit| -> Option<&'t LatentNode<'t, Node<'t>>> {
                match unit.data {
                    ast::DesignUnitData::PkgDecl(ref decl) => {
                        Some(Package2::alloc_slot(decl, ctx).ok()?)
                    }
                    _ => None,
                }
            })
            .collect();
        let lib = ctx.alloc(Library {
            name: name,
            units: units,
            scope: ctx.scope(),
        });
        ctx.define(
            Spanned::new(get_name_table().intern("WORK", false).into(), INVALID_SPAN),
            Def2::Lib(lib),
        )?;
        Ok(lib)
    }
pub fn new ( name : Name , units : & [ & ' t ast :: DesignUnit ] , ctx : AllocContext < ' t > , ) -> Result < & ' t Library < ' t > > { let ctx = ctx . create_subscope ( ) ; let units = units . into_iter ( ) . flat_map ( | unit | -> Option < & ' t LatentNode < ' t , Node < ' t > > > { match unit . data { ast :: DesignUnitData :: PkgDecl ( ref decl ) => { Some ( Package2 :: alloc_slot ( decl , ctx ) . ok ( ) ? ) } _ => None , } } ) . collect ( ) ; let lib = ctx . alloc ( Library { name : name , units : units , scope : ctx . scope ( ) , } ) ; ctx . define ( Spanned :: new ( get_name_table ( ) . intern ( " " , false ) . into ( ) , INVALID_SPAN ) , Def2 :: Lib ( lib ) , ) ? ; Ok ( lib ) }
Create a new library of design units.
Create a new library of design units .
name
Name
units
&[&'t ast::DesignUnit]
ctx
AllocContext<'t>
name
Name
units
&[&'t ast::DesignUnit]
ctx
AllocContext<'t>