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

Unstable: &'static str from Encoding #70

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

madsmtm
Copy link
Owner

@madsmtm madsmtm commented Nov 3, 2021

Idea is that we generate an array in a const fn, and then get a reference to that array and put it in a const.

Requires rust-lang/rust#76560.

Another approach would be to require Encode implementors to add a macro to the end, like this:

unsafe impl Encode for MyType {
    const ENCODING: Encoding<'static> = ...;
    end_encode_impl!();
}

@madsmtm madsmtm added the enhancement New feature or request label Nov 3, 2021
@madsmtm
Copy link
Owner Author

madsmtm commented Nov 3, 2021

Though of course rust-lang/const-eval#20 would make this much, much easier!

madsmtm added a commit that referenced this pull request May 22, 2022
Will be used at some point when generic constants are available, see #70
madsmtm added a commit that referenced this pull request May 22, 2022
Will be used at some point when generic constants are available, see #70
@madsmtm madsmtm force-pushed the static-encoding-str branch 2 times, most recently from 1f7f189 to 2ae705f Compare May 23, 2022 20:38
@madsmtm madsmtm marked this pull request as draft May 24, 2022 22:28
@madsmtm madsmtm changed the title WIP: &'static str from Encoding Unstable: &'static str from Encoding Jun 24, 2022
@madsmtm madsmtm force-pushed the static-encoding-str branch 3 times, most recently from fdce3e9 to bb0e66b Compare August 9, 2022 19:49
@madsmtm madsmtm added the A-objc2 Affects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` crates label Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-objc2 Affects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` crates enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant