Skip to content

Proposition for a stable API #338

@tomaka

Description

@tomaka

The current API is pretty crappy, so here is my proposition to have a clean API and release some kind of non-work-in-progress version of the gl_generator.

  • Hide the registry and generators modules from the outside of the crate.
  • Only expose one single function named generate.

As far as I know, nobody has written an external generator yet, so I don't think it's a problem to remove this possibility.

The signature of generate would be like this:

fn generate<W, I>(output: &mut W, generator: GeneratorType, api: Api,
                  version: &str, profile: &str, extensions: I, fallbacks: Fallbacks)
                  -> Result<(), Error>
                  where W: Write, I: IntoIterator, I::Item: AsRef<str>
  • The user would no longer need to depend on khronos_api (major point IMO)
  • The namespace and XML files would be automatically deducted from the api
  • Anything could be passed for extensions, be it a Vec<String> or a &[&str].
  • version and profile are still strings as their content are peeked directly at the XML files. Not using an enum means that we won't have to do any modification when a new version of OpenGL is released.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions