|
| 1 | +// Copyright 2025 Google LLC |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | +// |
| 15 | +// Code generated by sidekick. DO NOT EDIT. |
| 16 | + |
| 17 | +impl gaxi::prost::ToProto<WireFormat> for crate::generated::gapic::model::WireFormat { |
| 18 | + type Output = i32; |
| 19 | + fn to_proto(self) -> std::result::Result<Self::Output, gaxi::prost::ConvertError> { |
| 20 | + self.value().ok_or(gaxi::prost::ConvertError::EnumNoIntegerValue("crate::generated::gapic::model::WireFormat")) |
| 21 | + } |
| 22 | +} |
| 23 | + |
| 24 | +impl gaxi::prost::ToProto<TestCategory> for crate::generated::gapic::model::TestCategory { |
| 25 | + type Output = i32; |
| 26 | + fn to_proto(self) -> std::result::Result<Self::Output, gaxi::prost::ConvertError> { |
| 27 | + self.value().ok_or(gaxi::prost::ConvertError::EnumNoIntegerValue("crate::generated::gapic::model::TestCategory")) |
| 28 | + } |
| 29 | +} |
| 30 | + |
| 31 | +impl gaxi::prost::ToProto<TestStatus> for crate::generated::gapic::model::TestStatus { |
| 32 | + type Output = TestStatus; |
| 33 | + fn to_proto(self) -> std::result::Result<TestStatus, gaxi::prost::ConvertError> { |
| 34 | + Ok(Self::Output { |
| 35 | + name: self.name.to_proto()?, |
| 36 | + failure_message: self.failure_message.to_proto()?, |
| 37 | + matched_name: self.matched_name.to_proto()?, |
| 38 | + }) |
| 39 | + } |
| 40 | +} |
| 41 | + |
| 42 | +impl gaxi::prost::FromProto<crate::generated::gapic::model::TestStatus> for TestStatus { |
| 43 | + fn cnv(self) -> std::result::Result<crate::generated::gapic::model::TestStatus, gaxi::prost::ConvertError> { |
| 44 | + Ok( |
| 45 | + crate::generated::gapic::model::TestStatus::new() |
| 46 | + .set_name(self.name) |
| 47 | + .set_failure_message(self.failure_message) |
| 48 | + .set_matched_name(self.matched_name) |
| 49 | + ) |
| 50 | + } |
| 51 | +} |
| 52 | + |
| 53 | +impl gaxi::prost::ToProto<FailureSet> for crate::generated::gapic::model::FailureSet { |
| 54 | + type Output = FailureSet; |
| 55 | + fn to_proto(self) -> std::result::Result<FailureSet, gaxi::prost::ConvertError> { |
| 56 | + Ok(Self::Output { |
| 57 | + test: self.test |
| 58 | + .into_iter() |
| 59 | + .map(|v| v.to_proto()) |
| 60 | + .collect::<std::result::Result<std::vec::Vec<_>, _>>()?, |
| 61 | + }) |
| 62 | + } |
| 63 | +} |
| 64 | + |
| 65 | +impl gaxi::prost::FromProto<crate::generated::gapic::model::FailureSet> for FailureSet { |
| 66 | + fn cnv(self) -> std::result::Result<crate::generated::gapic::model::FailureSet, gaxi::prost::ConvertError> { |
| 67 | + Ok( |
| 68 | + crate::generated::gapic::model::FailureSet::new() |
| 69 | + .set_test(self.test.into_iter().map(|v| v.cnv()) |
| 70 | + .collect::<std::result::Result<std::vec::Vec<_>, _>>()?) |
| 71 | + ) |
| 72 | + } |
| 73 | +} |
| 74 | + |
| 75 | +impl gaxi::prost::ToProto<conformance_request::Payload> for crate::generated::gapic::model::conformance_request::Payload { |
| 76 | + type Output = conformance_request::Payload; |
| 77 | + fn to_proto(self) -> std::result::Result<Self::Output, gaxi::prost::ConvertError> { |
| 78 | + match self { |
| 79 | + Self::ProtobufPayload(v) => Ok(Self::Output::ProtobufPayload(v.to_proto()?)), |
| 80 | + Self::JsonPayload(v) => Ok(Self::Output::JsonPayload(v.to_proto()?)), |
| 81 | + Self::JspbPayload(v) => Ok(Self::Output::JspbPayload(v.to_proto()?)), |
| 82 | + Self::TextPayload(v) => Ok(Self::Output::TextPayload(v.to_proto()?)), |
| 83 | + } |
| 84 | + } |
| 85 | +} |
| 86 | + |
| 87 | +impl gaxi::prost::FromProto<crate::generated::gapic::model::conformance_request::Payload> for conformance_request::Payload { |
| 88 | + fn cnv(self) -> std::result::Result<crate::generated::gapic::model::conformance_request::Payload, gaxi::prost::ConvertError> { |
| 89 | + use crate::generated::gapic::model::conformance_request::Payload as T; |
| 90 | + match self { |
| 91 | + Self::ProtobufPayload(v) => Ok(T::from_protobuf_payload(v.cnv()?)), |
| 92 | + Self::JsonPayload(v) => Ok(T::from_json_payload(v.cnv()?)), |
| 93 | + Self::JspbPayload(v) => Ok(T::from_jspb_payload(v.cnv()?)), |
| 94 | + Self::TextPayload(v) => Ok(T::from_text_payload(v.cnv()?)), |
| 95 | + } |
| 96 | + } |
| 97 | +} |
| 98 | + |
| 99 | +impl gaxi::prost::ToProto<ConformanceRequest> for crate::generated::gapic::model::ConformanceRequest { |
| 100 | + type Output = ConformanceRequest; |
| 101 | + fn to_proto(self) -> std::result::Result<ConformanceRequest, gaxi::prost::ConvertError> { |
| 102 | + Ok(Self::Output { |
| 103 | + requested_output_format: self.requested_output_format.to_proto()?, |
| 104 | + message_type: self.message_type.to_proto()?, |
| 105 | + test_category: self.test_category.to_proto()?, |
| 106 | + jspb_encoding_options: self.jspb_encoding_options.map(|v| v.to_proto()).transpose()?, |
| 107 | + print_unknown_fields: self.print_unknown_fields.to_proto()?, |
| 108 | + payload: self.payload.map(|v| v.to_proto()).transpose()?, |
| 109 | + }) |
| 110 | + } |
| 111 | +} |
| 112 | + |
| 113 | +impl gaxi::prost::FromProto<crate::generated::gapic::model::ConformanceRequest> for ConformanceRequest { |
| 114 | + fn cnv(self) -> std::result::Result<crate::generated::gapic::model::ConformanceRequest, gaxi::prost::ConvertError> { |
| 115 | + Ok( |
| 116 | + crate::generated::gapic::model::ConformanceRequest::new() |
| 117 | + .set_requested_output_format(self.requested_output_format) |
| 118 | + .set_message_type(self.message_type) |
| 119 | + .set_test_category(self.test_category) |
| 120 | + .set_or_clear_jspb_encoding_options(self.jspb_encoding_options.map(|v| v.cnv()).transpose()?) |
| 121 | + .set_print_unknown_fields(self.print_unknown_fields) |
| 122 | + .set_payload(self.payload.map(|v| v.cnv()).transpose()?) |
| 123 | + ) |
| 124 | + } |
| 125 | +} |
| 126 | + |
| 127 | +impl gaxi::prost::ToProto<conformance_response::Result> for crate::generated::gapic::model::conformance_response::Result { |
| 128 | + type Output = conformance_response::Result; |
| 129 | + fn to_proto(self) -> std::result::Result<Self::Output, gaxi::prost::ConvertError> { |
| 130 | + match self { |
| 131 | + Self::ParseError(v) => Ok(Self::Output::ParseError(v.to_proto()?)), |
| 132 | + Self::SerializeError(v) => Ok(Self::Output::SerializeError(v.to_proto()?)), |
| 133 | + Self::TimeoutError(v) => Ok(Self::Output::TimeoutError(v.to_proto()?)), |
| 134 | + Self::RuntimeError(v) => Ok(Self::Output::RuntimeError(v.to_proto()?)), |
| 135 | + Self::ProtobufPayload(v) => Ok(Self::Output::ProtobufPayload(v.to_proto()?)), |
| 136 | + Self::JsonPayload(v) => Ok(Self::Output::JsonPayload(v.to_proto()?)), |
| 137 | + Self::Skipped(v) => Ok(Self::Output::Skipped(v.to_proto()?)), |
| 138 | + Self::JspbPayload(v) => Ok(Self::Output::JspbPayload(v.to_proto()?)), |
| 139 | + Self::TextPayload(v) => Ok(Self::Output::TextPayload(v.to_proto()?)), |
| 140 | + } |
| 141 | + } |
| 142 | +} |
| 143 | + |
| 144 | +impl gaxi::prost::FromProto<crate::generated::gapic::model::conformance_response::Result> for conformance_response::Result { |
| 145 | + fn cnv(self) -> std::result::Result<crate::generated::gapic::model::conformance_response::Result, gaxi::prost::ConvertError> { |
| 146 | + use crate::generated::gapic::model::conformance_response::Result as T; |
| 147 | + match self { |
| 148 | + Self::ParseError(v) => Ok(T::from_parse_error(v.cnv()?)), |
| 149 | + Self::SerializeError(v) => Ok(T::from_serialize_error(v.cnv()?)), |
| 150 | + Self::TimeoutError(v) => Ok(T::from_timeout_error(v.cnv()?)), |
| 151 | + Self::RuntimeError(v) => Ok(T::from_runtime_error(v.cnv()?)), |
| 152 | + Self::ProtobufPayload(v) => Ok(T::from_protobuf_payload(v.cnv()?)), |
| 153 | + Self::JsonPayload(v) => Ok(T::from_json_payload(v.cnv()?)), |
| 154 | + Self::Skipped(v) => Ok(T::from_skipped(v.cnv()?)), |
| 155 | + Self::JspbPayload(v) => Ok(T::from_jspb_payload(v.cnv()?)), |
| 156 | + Self::TextPayload(v) => Ok(T::from_text_payload(v.cnv()?)), |
| 157 | + } |
| 158 | + } |
| 159 | +} |
| 160 | + |
| 161 | +impl gaxi::prost::ToProto<ConformanceResponse> for crate::generated::gapic::model::ConformanceResponse { |
| 162 | + type Output = ConformanceResponse; |
| 163 | + fn to_proto(self) -> std::result::Result<ConformanceResponse, gaxi::prost::ConvertError> { |
| 164 | + Ok(Self::Output { |
| 165 | + result: self.result.map(|v| v.to_proto()).transpose()?, |
| 166 | + }) |
| 167 | + } |
| 168 | +} |
| 169 | + |
| 170 | +impl gaxi::prost::FromProto<crate::generated::gapic::model::ConformanceResponse> for ConformanceResponse { |
| 171 | + fn cnv(self) -> std::result::Result<crate::generated::gapic::model::ConformanceResponse, gaxi::prost::ConvertError> { |
| 172 | + Ok( |
| 173 | + crate::generated::gapic::model::ConformanceResponse::new() |
| 174 | + .set_result(self.result.map(|v| v.cnv()).transpose()?) |
| 175 | + ) |
| 176 | + } |
| 177 | +} |
| 178 | + |
| 179 | +impl gaxi::prost::ToProto<JspbEncodingConfig> for crate::generated::gapic::model::JspbEncodingConfig { |
| 180 | + type Output = JspbEncodingConfig; |
| 181 | + fn to_proto(self) -> std::result::Result<JspbEncodingConfig, gaxi::prost::ConvertError> { |
| 182 | + Ok(Self::Output { |
| 183 | + use_jspb_array_any_format: self.use_jspb_array_any_format.to_proto()?, |
| 184 | + }) |
| 185 | + } |
| 186 | +} |
| 187 | + |
| 188 | +impl gaxi::prost::FromProto<crate::generated::gapic::model::JspbEncodingConfig> for JspbEncodingConfig { |
| 189 | + fn cnv(self) -> std::result::Result<crate::generated::gapic::model::JspbEncodingConfig, gaxi::prost::ConvertError> { |
| 190 | + Ok( |
| 191 | + crate::generated::gapic::model::JspbEncodingConfig::new() |
| 192 | + .set_use_jspb_array_any_format(self.use_jspb_array_any_format) |
| 193 | + ) |
| 194 | + } |
| 195 | +} |
0 commit comments