Skip to content

Instantly share code, notes, and snippets.

@MaikKlein
Last active January 4, 2018 15:24
Show Gist options
  • Select an option

  • Save MaikKlein/f7fefe1dc6a99c334bd8c4384ef4651d to your computer and use it in GitHub Desktop.

Select an option

Save MaikKlein/f7fefe1dc6a99c334bd8c4384ef4651d to your computer and use it in GitHub Desktop.
impl #ident{
#[cfg(feature = "std")] // This is somehow lost :(
pub fn from_bitflag(bitflag: ::enumflags::BitFlags<#ident>) -> Vec<#ident> {
#flag_values_ref1.iter().filter_map(|val|{
let val = *val as #ty & bitflag.bits();
match val {
#(#flag_value_names => Some(#names_ref :: #variants_ref),)*
_ => None
}
}).collect()
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment