Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support cfg in rquickjs::methods #334

Open
Sytten opened this issue Jul 16, 2024 · 0 comments
Open

Support cfg in rquickjs::methods #334

Sytten opened this issue Jul 16, 2024 · 0 comments

Comments

@Sytten
Copy link
Contributor

Sytten commented Jul 16, 2024

Hi!
Right now there is really no easy way in stable rust (without rust-lang/rust#82679), to make methods conditional on the OS.

You cant do:

 #[cfg(unix)]
 #[qjs(get, enumerable)]
 pub fn atime_ms(&self) -> i64 {
     self.metadata.atime_nsec() / 1e6 as i64
 }

Since the cfg is evaluated after the methods macro.

I see two ways to get around that. One is allowing multiple methods macros (though I know this is hard). The other would be to support the cfg inside the macro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant