stripe_shared/
payment_flows_payment_intent_async_workflows_resource_inputs.rs1#[derive(Clone, Eq, PartialEq)]
2#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
4#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
5pub struct PaymentFlowsPaymentIntentAsyncWorkflowsResourceInputs {
6 pub tax:
7 Option<stripe_shared::PaymentFlowsPaymentIntentAsyncWorkflowsResourceInputsResourceTax>,
8}
9#[cfg(feature = "redact-generated-debug")]
10impl std::fmt::Debug for PaymentFlowsPaymentIntentAsyncWorkflowsResourceInputs {
11 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
12 f.debug_struct("PaymentFlowsPaymentIntentAsyncWorkflowsResourceInputs")
13 .finish_non_exhaustive()
14 }
15}
16#[doc(hidden)]
17pub struct PaymentFlowsPaymentIntentAsyncWorkflowsResourceInputsBuilder {
18 tax: Option<
19 Option<stripe_shared::PaymentFlowsPaymentIntentAsyncWorkflowsResourceInputsResourceTax>,
20 >,
21}
22
23#[allow(
24 unused_variables,
25 irrefutable_let_patterns,
26 clippy::let_unit_value,
27 clippy::match_single_binding,
28 clippy::single_match
29)]
30const _: () = {
31 use miniserde::de::{Map, Visitor};
32 use miniserde::json::Value;
33 use miniserde::{Deserialize, Result, make_place};
34 use stripe_types::miniserde_helpers::FromValueOpt;
35 use stripe_types::{MapBuilder, ObjectDeser};
36
37 make_place!(Place);
38
39 impl Deserialize for PaymentFlowsPaymentIntentAsyncWorkflowsResourceInputs {
40 fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
41 Place::new(out)
42 }
43 }
44
45 struct Builder<'a> {
46 out: &'a mut Option<PaymentFlowsPaymentIntentAsyncWorkflowsResourceInputs>,
47 builder: PaymentFlowsPaymentIntentAsyncWorkflowsResourceInputsBuilder,
48 }
49
50 impl Visitor for Place<PaymentFlowsPaymentIntentAsyncWorkflowsResourceInputs> {
51 fn map(&mut self) -> Result<Box<dyn Map + '_>> {
52 Ok(Box::new(Builder {
53 out: &mut self.out,
54 builder:
55 PaymentFlowsPaymentIntentAsyncWorkflowsResourceInputsBuilder::deser_default(),
56 }))
57 }
58 }
59
60 impl MapBuilder for PaymentFlowsPaymentIntentAsyncWorkflowsResourceInputsBuilder {
61 type Out = PaymentFlowsPaymentIntentAsyncWorkflowsResourceInputs;
62 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
63 Ok(match k {
64 "tax" => Deserialize::begin(&mut self.tax),
65 _ => <dyn Visitor>::ignore(),
66 })
67 }
68
69 fn deser_default() -> Self {
70 Self { tax: Some(None) }
71 }
72
73 fn take_out(&mut self) -> Option<Self::Out> {
74 let (Some(tax),) = (self.tax.take(),) else {
75 return None;
76 };
77 Some(Self::Out { tax })
78 }
79 }
80
81 impl Map for Builder<'_> {
82 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
83 self.builder.key(k)
84 }
85
86 fn finish(&mut self) -> Result<()> {
87 *self.out = self.builder.take_out();
88 Ok(())
89 }
90 }
91
92 impl ObjectDeser for PaymentFlowsPaymentIntentAsyncWorkflowsResourceInputs {
93 type Builder = PaymentFlowsPaymentIntentAsyncWorkflowsResourceInputsBuilder;
94 }
95
96 impl FromValueOpt for PaymentFlowsPaymentIntentAsyncWorkflowsResourceInputs {
97 fn from_value(v: Value) -> Option<Self> {
98 let Value::Object(obj) = v else {
99 return None;
100 };
101 let mut b =
102 PaymentFlowsPaymentIntentAsyncWorkflowsResourceInputsBuilder::deser_default();
103 for (k, v) in obj {
104 match k.as_str() {
105 "tax" => b.tax = FromValueOpt::from_value(v),
106 _ => {}
107 }
108 }
109 b.take_out()
110 }
111 }
112};