Skip to content

Commit 727e21a

Browse files
committed
Update all examples to use oneOf enums
1 parent 24fef3f commit 727e21a

File tree

9 files changed

+108
-190
lines changed
  • checkout/rust/cart-transform/bundles/src
  • sample-apps
    • bundles-cart-transform/extensions/cart-merge-expand/src
    • delivery-customizations/extensions/delivery-customization-rust/src
    • discounts/extensions/product-discount-rust/src
    • payment-customizations/extensions/payment-customization-rust/src

9 files changed

+108
-190
lines changed

Cargo.lock

Lines changed: 54 additions & 88 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

checkout/rust/cart-transform/bundles/src/main.rs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,13 @@ fn get_merge_cart_operations(cart: &Cart) -> impl Iterator<Item = CartOperation>
8787
}),
8888
});
8989

90-
let merge_operation = MergeOperation {
90+
CartOperation::Merge(MergeOperation {
9191
parent_variant_id: definition.id,
9292
title: None,
9393
cart_lines,
9494
image: None,
9595
price,
96-
};
97-
98-
CartOperation {
99-
merge: Some(merge_operation),
100-
expand: None,
101-
}
96+
})
10297
})
10398
})
10499
}
@@ -183,16 +178,12 @@ fn get_expand_cart_operations(cart: &Cart) -> impl Iterator<Item = CartOperation
183178

184179
let price = get_price_adjustment(merchandise);
185180

186-
let expand_operation = ExpandOperation {
181+
CartOperation::Expand(ExpandOperation {
187182
cart_line_id: line.id.clone(),
188183
expanded_cart_items: expand_relationships,
189184
price,
190-
};
191-
192-
Some(CartOperation {
193-
expand: Some(expand_operation),
194-
merge: None,
195185
})
186+
.into()
196187
}
197188
} else {
198189
None

0 commit comments

Comments
 (0)