/// Recursively load a directory of starlark generators. These files must
/// end in '.star' and define a function 'generator' that accepts a single
/// ['metalos.Host'](crate::Host) parameter. Starlark files in the
/// directory are available to be `load()`ed by generators.
Recursively load a directory of starlark generators.
Recursively load a directory of starlark generators .
pub fn load(path: impl AsRef<Path>) -> Result<Vec<Self>> {
        Loader::load(path)?
            .into_iter()
            .map(|(id, module)| {
                let starlark_func = module.get("generator").ok_or(Error::NotGenerator)?;
                Ok(Self { id, starlark_func })
            })
            .filter(|r| match r {
                Err(Error::NotGenerator) => false,
                _ => true,
            })
            .collect()
    }
pub fn load ( path : impl AsRef < Path > ) -> Result < Vec < Self > > { Loader :: load ( path ) ? . into_iter ( ) . map ( | ( id , module ) | { let starlark_func = module . get ( " " ) . ok_or ( Error :: NotGenerator ) ? ; Ok ( Self { id , starlark_func } ) } ) . filter ( | r | match r { Err ( Error :: NotGenerator ) => false , _ => true , } ) . collect ( ) }
Recursively load a directory of starlark generators.
Recursively load a directory of starlark generators .
path
impl AsRef<Path>