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

Document how to implement CLike for using EnumSet #13752

Closed
SimonSapin opened this issue Apr 25, 2014 · 1 comment
Closed

Document how to implement CLike for using EnumSet #13752

SimonSapin opened this issue Apr 25, 2014 · 1 comment

Comments

@SimonSapin
Copy link
Contributor

According to the tests, this code needed to use collections::enum_set::EnumSet:

    #[repr(uint)]
    enum Foo {
        A, B, C
    }

    impl CLike for Foo {
        fn to_uint(&self) -> uint {
            *self as uint
        }

        fn from_uint(v: uint) -> Foo {
            unsafe { cast::transmute(v) }
        }
    }

If it is indeed needed, that should be documented.

Also, it would be nice to not have to duplicate this impl for every enum type that one wants to use with EnumSet.

@Gankra
Copy link
Contributor

Gankra commented Jan 6, 2015

EnumSet is not in std lib anymore.

@Gankra Gankra closed this as completed Jan 6, 2015
flip1995 pushed a commit to flip1995/rust that referenced this issue Dec 15, 2024
Fix rust-lang#13749

changelog: [`needless_lifetimes`]: do not suggest using `'_` in `where`
clauses
flip1995 pushed a commit to flip1995/rust that referenced this issue Dec 15, 2024
flip1995 pushed a commit to flip1995/rust that referenced this issue Dec 15, 2024
…13752 (rust-lang#13771)

Tiny change to make `report_elidable_impl_lifetimes`'s doc comment
consistent with rust-lang#13752. (cc: @samueltardieu)

---

changelog: none
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

2 participants