-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Labels
D-discussionA decision (D) has not been made yet and is open to discussionA decision (D) has not been made yet and is open to discussionI-featureThis issue (I) regards a (potential) feature in the projectThis issue (I) regards a (potential) feature in the projectT-acceptedTriage (T): Initial review accepted issue/PR as validTriage (T): Initial review accepted issue/PR as valid
Description
Short Description:
I was hoping to have a way to substitute a value in to the name of a token. For example:
#[duplicate_item(
int_type max_value;
[ u8 ] [ 255 ];
[ u16 ] [ 65_535 ];
[ u32 ] [ 4_294_967_295 ];
)]
fn is_[int_type]_max(&self) -> bool {
*self == max_value
}
// Generates...
fn is_u8_max(&self) -> bool {
*self == 255
}
fn is_u16_max(&self) -> bool {
*self == 65_535
}
// etc.I've read through the docs and can't seem to find a way to do so without restoring to using something like paste!. Is that possible?
Metadata
Metadata
Assignees
Labels
D-discussionA decision (D) has not been made yet and is open to discussionA decision (D) has not been made yet and is open to discussionI-featureThis issue (I) regards a (potential) feature in the projectThis issue (I) regards a (potential) feature in the projectT-acceptedTriage (T): Initial review accepted issue/PR as validTriage (T): Initial review accepted issue/PR as valid