Skip to content

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 madsmtm force-pushed the static-encoding-str branch from 94ae38d to 05658b2 Compare May 22, 2022 15:46
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 force-pushed the static-encoding-str branch from bb0e66b to 9c31a41 Compare September 1, 2023 17:39
@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