Skip to content

declare_gl_apis! macros doesn't allow us to add default function implementations #229

@jamienicol

Description

@jamienicol

For #228, I would have liked to add default (empty) implementations of the newly added functions. This would be nice because a) the extension I'm exposing is GLES-only, so does not need a GlFns implementation. And b) currently every time we expose a new API to the Gl trait it's a breaking change and we have to bump the semver, and in gecko we need to add an impl to our swgl trait, even when it won't be used.

Unfortunately, trying to add a default impl currently results in a compilation error due to the declare_gl_apis macro:

error: no rules expected the token `{`
   --> src/gl.rs:765:113
    |
81  | macro_rules! declare_gl_apis {
    | ---------------------------- when calling this macro
...
765 |     fn start_tiling_qcom(&self, x: GLuint, y: GLuint, width: GLuint, height: GLuint, preserve_mask: GLbitfield) {
    |                                                                                                                 ^ no rules expected this token in macro call
    |
note: while trying to match `;`
   --> src/gl.rs:83:106
    |
83  |     ($($(unsafe $([$garbo:expr])*)* fn $name:ident(&self $(, $arg:ident: $t:ty)* $(,)*) $(-> $retty:ty)* ;)+) => {
    |

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