pub fn new(api: Api, exts: Exts) -> Registry {
        let mut result = Registry::default();

        // First load definitions from all API versions
        // up to the one requested.
        for idl_const in api.idl_consts() {
            for def in parse_defs(idl_const) {
                result.load_definition(def);
            }
        }

        // Next find all requested extensions
        for ext in exts.enumerate() {
            if api < ext.min_api {
                continue;
            }

            // Make a note that we included this extension
            result.extensions.insert(ext.name.clone());

            // Load the definitions
            for def in parse_defs(ext.idl.as_bytes()) {
                result.load_definition(def);
            }

            // Attach overview doc comment
            let ext_iface = result
                .types
                .get_mut(&ext.name)
                .and_then(NamedType::as_interface_mut)
                .expect(&ext.name);
            ext_iface.doc_comment = ext.overview;

            // Attach individual function doc comments
            for (name, new_fun) in ext.new_funs {
                let members = ext_iface.members.get_mut(&name).unwrap();
                for member in members {
                    if let Member::Operation(ref mut op) = *member {
                        op.doc_comment = new_fun.clone();
                    }
                }
            }
        }

        // Find the latest version of the rendering context, and generate a
        // version-independent rendering context helper type called "GLContext".
        for name in RENDERING_CONTEXTS.into_iter().rev() {
            if let Some(NamedType::Interface(mut iface)) = result.types.get(name.1).cloned() {
                iface.rendering_context = None;
                result
                    .types
                    .insert("GLContext".into(), NamedType::Interface(iface));
                break;
            }
        }

        // Hide types that are listed in our "hidden names" array
        for &hidden_name in HIDDEN_NAMES {
            if let Some(interface) = result
                .types
                .get_mut(hidden_name)
                .and_then(NamedType::as_interface_mut)
            {
                interface.is_hidden = true;
            }
            if let Some(dictionary) = result
                .types
                .get_mut(hidden_name)
                .and_then(NamedType::as_dictionary_mut)
            {
                dictionary.is_hidden = true;
            }
        }

        // Done!
        result
    }
/// Construct a new registry given a maximum API version
/// and a set of extensions to support.
Construct a new registry given a maximum API version
and a set of extensions to support.
Construct a new registry given a maximum API version and a set of extensions to support .
pub fn new(api: Api, exts: Exts) -> Registry {
        let mut result = Registry::default();
        // First load definitions from all API versions
        // up to the one requested.
        for idl_const in api.idl_consts() {
            for def in parse_defs(idl_const) {
                result.load_definition(def);
            }
        }
        // Next find all requested extensions
        for ext in exts.enumerate() {
            if api < ext.min_api {
                continue;
            }
            // Make a note that we included this extension
            result.extensions.insert(ext.name.clone());
            // Load the definitions
            for def in parse_defs(ext.idl.as_bytes()) {
                result.load_definition(def);
            }
            // Attach overview doc comment
            let ext_iface = result
                .types
                .get_mut(&ext.name)
                .and_then(NamedType::as_interface_mut)
                .expect(&ext.name);
            ext_iface.doc_comment = ext.overview;
            // Attach individual function doc comments
            for (name, new_fun) in ext.new_funs {
                let members = ext_iface.members.get_mut(&name).unwrap();
                for member in members {
                    if let Member::Operation(ref mut op) = *member {
                        op.doc_comment = new_fun.clone();
                    }
                }
            }
        }
        // Find the latest version of the rendering context, and generate a
        // version-independent rendering context helper type called "GLContext".
        for name in RENDERING_CONTEXTS.into_iter().rev() {
            if let Some(NamedType::Interface(mut iface)) = result.types.get(name.1).cloned() {
                iface.rendering_context = None;
                result
                    .types
                    .insert("GLContext".into(), NamedType::Interface(iface));
                break;
            }
        }
        // Hide types that are listed in our "hidden names" array
        for &hidden_name in HIDDEN_NAMES {
            if let Some(interface) = result
                .types
                .get_mut(hidden_name)
                .and_then(NamedType::as_interface_mut)
            {
                interface.is_hidden = true;
            }
            if let Some(dictionary) = result
                .types
                .get_mut(hidden_name)
                .and_then(NamedType::as_dictionary_mut)
            {
                dictionary.is_hidden = true;
            }
        }
        // Done!
        result
    }
pub fn new ( api : Api , exts : Exts ) -> Registry { let mut result = Registry :: default ( ) ; // First load definitions from all API versions // up to the one requested. for idl_const in api . idl_consts ( ) { for def in parse_defs ( idl_const ) { result . load_definition ( def ) ; } } // Next find all requested extensions for ext in exts . enumerate ( ) { if api < ext . min_api { continue ; } // Make a note that we included this extension result . extensions . insert ( ext . name . clone ( ) ) ; // Load the definitions for def in parse_defs ( ext . idl . as_bytes ( ) ) { result . load_definition ( def ) ; } // Attach overview doc comment let ext_iface = result . types . get_mut ( & ext . name ) . and_then ( NamedType :: as_interface_mut ) . expect ( & ext . name ) ; ext_iface . doc_comment = ext . overview ; // Attach individual function doc comments for ( name , new_fun ) in ext . new_funs { let members = ext_iface . members . get_mut ( & name ) . unwrap ( ) ; for member in members { if let Member :: Operation ( ref mut op ) = * member { op . doc_comment = new_fun . clone ( ) ; } } } } // Find the latest version of the rendering context, and generate a // version-independent rendering context helper type called "GLContext". for name in RENDERING_CONTEXTS . into_iter ( ) . rev ( ) { if let Some ( NamedType :: Interface ( mut iface ) ) = result . types . get ( name . 1 ) . cloned ( ) { iface . rendering_context = None ; result . types . insert ( " " . into ( ) , NamedType :: Interface ( iface ) ) ; break ; } } // Hide types that are listed in our "hidden names" array for & hidden_name in HIDDEN_NAMES { if let Some ( interface ) = result . types . get_mut ( hidden_name ) . and_then ( NamedType :: as_interface_mut ) { interface . is_hidden = true ; } if let Some ( dictionary ) = result . types . get_mut ( hidden_name ) . and_then ( NamedType :: as_dictionary_mut ) { dictionary . is_hidden = true ; } } // Done! result }
Construct a new registry given a maximum API version
and a set of extensions to support.
Construct a new registry given a maximum API version and a set of extensions to support .
api
Api
exts
Exts