aws_db_esdk/deps/aws_cryptography_materialProviders/conversions/
keyring.rs1#[allow(dead_code)]
5pub fn to_dafny(
6 value: &crate::deps::aws_cryptography_materialProviders::types::keyring::KeyringRef,
7) -> ::dafny_runtime::Object<
8 dyn crate::r#software::amazon::cryptography::materialproviders::internaldafny::types::IKeyring,
9> {
10 let wrap = KeyringWrapper { obj: value.clone() };
11 let inner = ::dafny_runtime::Rc::new(::dafny_runtime::UnsafeCell::new(wrap));
12 ::dafny_runtime::Object(Some(inner))
13}
14
15pub struct KeyringWrapper {
16 obj: crate::deps::aws_cryptography_materialProviders::types::keyring::KeyringRef,
17}
18
19impl ::dafny_runtime::UpcastObject<::dafny_runtime::DynAny> for KeyringWrapper {
20 ::dafny_runtime::UpcastObjectFn!(::dafny_runtime::DynAny);
21}
22
23#[allow(dead_code)]
24pub fn from_dafny(
25 dafny_value: ::dafny_runtime::Object<
26 dyn crate::r#software::amazon::cryptography::materialproviders::internaldafny::types::IKeyring,
27 >,
28) -> crate::deps::aws_cryptography_materialProviders::types::keyring::KeyringRef {
29 let wrap = IKeyringDafnyWrapper {
30 obj: dafny_value.clone(),
31 };
32 crate::deps::aws_cryptography_materialProviders::types::keyring::KeyringRef {
33 inner: ::dafny_runtime::Rc::new(::dafny_runtime::RefCell::new(wrap)),
34 }
35}
36
37#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
38pub struct IKeyringDafnyWrapper {
39 pub(crate) obj: ::dafny_runtime::Object<
40 dyn crate::r#software::amazon::cryptography::materialproviders::internaldafny::types::IKeyring,
41 >,
42}
43
44impl crate::software::amazon::cryptography::materialproviders::internaldafny::types::IKeyring
45 for KeyringWrapper
46{
47 fn r#_OnEncrypt_k(
48 &self,
49 input: &::dafny_runtime::Rc<crate::software::amazon::cryptography::materialproviders::internaldafny::types::OnEncryptInput>,
50) -> ::dafny_runtime::Rc<
51 crate::r#_Wrappers_Compile::Result<
52 ::dafny_runtime::Rc<crate::r#software::amazon::cryptography::materialproviders::internaldafny::types::OnEncryptOutput>,
53 ::dafny_runtime::Rc<crate::r#software::amazon::cryptography::materialproviders::internaldafny::types::Error>,
54 >,
55>
56{
57 let inner_input = crate::deps::aws_cryptography_materialProviders::conversions::on_encrypt::_on_encrypt_input::from_dafny(input.clone());
58 let inner_result = self.obj.inner.lock().unwrap().on_encrypt(inner_input);
59 let result = match inner_result {
60 Ok(x) => crate::r#_Wrappers_Compile::Result::Success {
61 value: crate::deps::aws_cryptography_materialProviders::conversions::on_encrypt::_on_encrypt_output::to_dafny(x.clone()),
62 },
63 Err(x) => crate::r#_Wrappers_Compile::Result::Failure {
64 error: crate::deps::aws_cryptography_materialProviders::conversions::error::to_dafny(x),
65 },
66 };
67 ::dafny_runtime::Rc::new(result)
68 }
69
70fn r#_OnDecrypt_k(
71 &self,
72 input: &::dafny_runtime::Rc<crate::software::amazon::cryptography::materialproviders::internaldafny::types::OnDecryptInput>,
73) -> ::dafny_runtime::Rc<
74 crate::r#_Wrappers_Compile::Result<
75 ::dafny_runtime::Rc<crate::r#software::amazon::cryptography::materialproviders::internaldafny::types::OnDecryptOutput>,
76 ::dafny_runtime::Rc<crate::r#software::amazon::cryptography::materialproviders::internaldafny::types::Error>,
77 >,
78>
79{
80 let inner_input = crate::deps::aws_cryptography_materialProviders::conversions::on_decrypt::_on_decrypt_input::from_dafny(input.clone());
81 let inner_result = self.obj.inner.lock().unwrap().on_decrypt(inner_input);
82 let result = match inner_result {
83 Ok(x) => crate::r#_Wrappers_Compile::Result::Success {
84 value: crate::deps::aws_cryptography_materialProviders::conversions::on_decrypt::_on_decrypt_output::to_dafny(x.clone()),
85 },
86 Err(x) => crate::r#_Wrappers_Compile::Result::Failure {
87 error: crate::deps::aws_cryptography_materialProviders::conversions::error::to_dafny(x),
88 },
89 };
90 ::dafny_runtime::Rc::new(result)
91 }
92}
93
94impl crate::deps::aws_cryptography_materialProviders::types::keyring::Keyring
95 for IKeyringDafnyWrapper
96{
97 fn on_encrypt(
98 &self,
99 input: crate::deps::aws_cryptography_materialProviders::operation::on_encrypt::OnEncryptInput,
100 ) -> Result<
101 crate::deps::aws_cryptography_materialProviders::operation::on_encrypt::OnEncryptOutput,
102 crate::deps::aws_cryptography_materialProviders::types::error::Error,
103 > {
104 let inner_input = crate::deps::aws_cryptography_materialProviders::conversions::on_encrypt::_on_encrypt_input::to_dafny(input);
105 let inner_result = ::dafny_runtime::md!(self.obj.clone()).OnEncrypt(&inner_input);
106 if matches!(
107 inner_result.as_ref(),
108 crate::r#_Wrappers_Compile::Result::Success { .. }
109 ) {
110 Ok(
111 crate::deps::aws_cryptography_materialProviders::conversions::on_encrypt::_on_encrypt_output::from_dafny(inner_result.value().clone()),
112 )
113 } else {
114 Err(
115 crate::deps::aws_cryptography_materialProviders::conversions::error::from_dafny(
116 inner_result.error().clone(),
117 ),
118 )
119 }
120 }
121
122 fn on_decrypt(
123 &self,
124 input: crate::deps::aws_cryptography_materialProviders::operation::on_decrypt::OnDecryptInput,
125 ) -> Result<
126 crate::deps::aws_cryptography_materialProviders::operation::on_decrypt::OnDecryptOutput,
127 crate::deps::aws_cryptography_materialProviders::types::error::Error,
128 > {
129 let inner_input = crate::deps::aws_cryptography_materialProviders::conversions::on_decrypt::_on_decrypt_input::to_dafny(input);
130 let inner_result = ::dafny_runtime::md!(self.obj.clone()).OnDecrypt(&inner_input);
131 if matches!(
132 inner_result.as_ref(),
133 crate::r#_Wrappers_Compile::Result::Success { .. }
134 ) {
135 Ok(
136 crate::deps::aws_cryptography_materialProviders::conversions::on_decrypt::_on_decrypt_output::from_dafny(inner_result.value().clone()),
137 )
138 } else {
139 Err(
140 crate::deps::aws_cryptography_materialProviders::conversions::error::from_dafny(
141 inner_result.error().clone(),
142 ),
143 )
144 }
145 }
146}