example:
if interface.flags.contains(NatConfigFlags::NAT_IS_INSIDE) {
I couldn't find another way to compare if a given flag is in a set, but this method seems most discoverable and ergonomic for developers.
We can do this with a function named contains on the EnumFlag<T>, which just delegates to self.0.contains as long as we implement PartialEq for the Enums. (T) in this case.
This is another case where I have to change 2 repos to make this work. vpp-api-gen ( derive PartialEq), and vpp-api-encoding ( impl contains for EnumFlag where T is PartailEq.
example:
if interface.flags.contains(NatConfigFlags::NAT_IS_INSIDE) {
I couldn't find another way to compare if a given flag is in a set, but this method seems most discoverable and ergonomic for developers.
We can do this with a function named contains on the
EnumFlag<T>
, which just delegates toself.0.contains
as long as we implementPartialEq
for the Enums. (T) in this case.This is another case where I have to change 2 repos to make this work. vpp-api-gen ( derive PartialEq), and vpp-api-encoding ( impl contains for EnumFlag where T is PartailEq.
I have 2 patches I'll push up for review.