Convert `newtype_index` to a proc macro by Aaron1011 · Pull Request #93878 · rus...
source link: https://github.com/rust-lang/rust/pull/93878
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
///
/// - The `From` impls are the preferred way. So you can do
/// `S::from(v)` with a `usize` or `u32`. And you can convert back
/// to an integer with `u32::from(s)`.
I know this comment is pre-existing, but while we're here: is this advice correct? I personally prefer S::new(v)
and s.index()
, and I feel like I've seen those forms more often.
I'm not sure - I think this could be dealt with in a follow-up issue, since it's just a style reccomendation.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK