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

"Conditional compilation" blocks #8

Open
bonsairobo opened this issue Aug 5, 2023 · 1 comment
Open

"Conditional compilation" blocks #8

bonsairobo opened this issue Aug 5, 2023 · 1 comment

Comments

@bonsairobo
Copy link
Owner

bonsairobo commented Aug 5, 2023

Sometimes you get into tricky situations where you just need to specialize the archived implementation of a method. We might be able to support something like:

#[archive_impl]
impl Foo {
    fn do_it_up(&self) {
        #[if_archived] {
            // some archived-specific logic, like deserializing
        } #[else] {
            // the alternative
        }
    }
}

I don't know if that's good syntax. We might need to experiment.

@bonsairobo
Copy link
Owner Author

The alternative is to just add a method with the same name to both Foo and ArchivedFoo. This probably works better most of the time.

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