Note: This document covers API impact only. For more details, see the ABI compatibility page
- | init | step 1 | step 2 |
---|---|---|---|
fidl | link | link | |
dart | link | link | |
go | link | link | |
hlcpp | link | link | |
llcpp | link | link | |
rust | link | link |
type Flags = flexible bits {
OPTION_A = 1;
OPTION_B = 2;
};
void useBits(fidllib.Flags bits) {
if ((bits & fidllib.Flags.optionA).$value != 0) {
print('option A is set');
}
if ((bits & fidllib.Flags.optionB).$value != 0) {
print('option B is set');
}
if (bits.hasUnknownBits()) {
print('unknown options: ${bits.getUnknownBits()}');
}
}
func useBits(bits lib.Flags) {
if bits.HasBits(lib.FlagsOptionA) {
fmt.Println("option C is set")
}
if bits.HasBits(lib.FlagsOptionB) {
fmt.Println("option C is set")
}
if bits.HasUnknownBits() {
fmt.Printf("unknown options: 0x%x", bits.GetUnknownBits())
}
}
void use_member(fidl_test::Flags bits) {
if (bits & fidl_test::Flags::OPTION_A) {
printf("option A is set\n");
}
if (bits & fidl_test::Flags::OPTION_B) {
printf("option B is set\n");
}
if (bits.has_unknown_bits()) {
printf("unknown options: 0x%04x", uint32_t(bits.unknown_bits()));
}
}
void use_bits(fidl_test::wire::Flags bits) {
if (bits & fidl_test::wire::Flags::kOptionA) {
printf("option A is set\n");
}
if (bits & fidl_test::wire::Flags::kOptionB) {
printf("option B is set\n");
}
if (bits.has_unknown_bits()) {
printf("unknown options: 0x%04x", uint32_t(bits.unknown_bits()));
}
}
fn use_bits(bits: &fidl_lib::Flags) {
if bits.contains(fidl_lib::Flags::OptionA) {
println!("option A is set");
}
if bits.contains(fidl_lib::Flags::OptionB) {
println!("option B is set");
}
if bits.has_unknown_bits() {
println!("unknown options: {:x}", bits.get_unknown_bits());
}
}
- Add the new member
type Flags = flexible bits {
OPTION_A = 1;
OPTION_B = 2;
+ OPTION_C = 4;
};
- You can now use the new member
void useBits(fidllib.Flags bits) {
if ((bits & fidllib.Flags.optionA).$value != 0) {
print('option A is set');
}
if ((bits & fidllib.Flags.optionB).$value != 0) {
print('option B is set');
}
+ if ((bits & fidllib.Flags.optionC).$value != 0) {
+ print('option C is set');
+ }
if (bits.hasUnknownBits()) {
print('unknown options: ${bits.getUnknownBits()}');
}
}
- You can now use the new member
func useBits(bits lib.Flags) {
if bits.HasBits(lib.FlagsOptionA) {
fmt.Println("option C is set")
}
if bits.HasBits(lib.FlagsOptionB) {
fmt.Println("option C is set")
}
+ if bits.HasBits(lib.FlagsOptionC) {
+ fmt.Println("option C is set")
+ }
if bits.HasUnknownBits() {
fmt.Printf("unknown options: 0x%x", bits.GetUnknownBits())
}
}
- You can now use the new member
void use_member(fidl_test::Flags bits) {
if (bits & fidl_test::Flags::OPTION_A) {
printf("option A is set\n");
}
if (bits & fidl_test::Flags::OPTION_B) {
printf("option B is set\n");
}
+ if (bits & fidl_test::Flags::OPTION_C) {
+ printf("option C is set\n");
+ }
if (bits.has_unknown_bits()) {
printf("unknown options: 0x%04x", uint32_t(bits.unknown_bits()));
}
}
- You can now use the new member
void use_bits(fidl_test::wire::Flags bits) {
if (bits & fidl_test::wire::Flags::kOptionA) {
printf("option A is set\n");
}
if (bits & fidl_test::wire::Flags::kOptionB) {
printf("option B is set\n");
}
+ if (bits & fidl_test::wire::Flags::kOptionC) {
+ printf("option C is set\n");
+ }
if (bits.has_unknown_bits()) {
printf("unknown options: 0x%04x", uint32_t(bits.unknown_bits()));
}
}
- You can now use the new member
fn use_bits(bits: &fidl_lib::Flags) {
if bits.contains(fidl_lib::Flags::OptionA) {
println!("option A is set");
}
if bits.contains(fidl_lib::Flags::OptionB) {
println!("option B is set");
}
+ if bits.contains(fidl_lib::Flags::OptionC) {
+ println!("option C is set");
+ }
if bits.has_unknown_bits() {
println!("unknown options: {:x}", bits.get_unknown_bits());
}
}