Skip to content

Commit a3d13d7

Browse files
committed
[eclipse-iceoryx#690] Implement builder custom type API
1 parent 5ab5fea commit a3d13d7

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

iceoryx2/src/service/builder/request_response.rs

+53
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use crate::prelude::{AttributeSpecifier, AttributeVerifier};
1717
use crate::service::builder::OpenDynamicStorageFailure;
1818
use crate::service::dynamic_config::request_response::DynamicConfigSettings;
1919
use crate::service::port_factory::request_response;
20+
use crate::service::static_config::message_type_details::TypeDetail;
2021
use crate::service::static_config::messaging_pattern::MessagingPattern;
2122
use crate::service::{self, header, static_config};
2223
use crate::service::{builder, dynamic_config, Service};
@@ -27,6 +28,7 @@ use iceoryx2_cal::serialize::Serialize;
2728
use iceoryx2_cal::static_storage::{StaticStorage, StaticStorageCreateError, StaticStorageLocked};
2829

2930
use super::message_type_details::{MessageTypeDetails, TypeVariant};
31+
use super::publish_subscribe::{CustomHeaderMarker, CustomPayloadMarker};
3032
use super::{ServiceState, RETRY_LIMIT};
3133

3234
/// Errors that can occur when an existing [`MessagingPattern::RequestResponse`] [`Service`] shall
@@ -223,6 +225,10 @@ pub struct Builder<
223225
base: builder::BuilderWithServiceType<ServiceType>,
224226
override_request_alignment: Option<usize>,
225227
override_response_alignment: Option<usize>,
228+
override_request_payload_type: Option<TypeDetail>,
229+
override_response_payload_type: Option<TypeDetail>,
230+
override_request_header_type: Option<TypeDetail>,
231+
override_response_header_type: Option<TypeDetail>,
226232
verify_enable_safe_overflow_for_requests: bool,
227233
verify_enable_safe_overflow_for_responses: bool,
228234
verify_max_active_requests_per_client: bool,
@@ -253,6 +259,10 @@ impl<
253259
base,
254260
override_request_alignment: None,
255261
override_response_alignment: None,
262+
override_request_header_type: None,
263+
override_request_payload_type: None,
264+
override_response_header_type: None,
265+
override_response_payload_type: None,
256266
verify_enable_safe_overflow_for_requests: false,
257267
verify_enable_safe_overflow_for_responses: false,
258268
verify_max_loaned_requests: false,
@@ -1423,3 +1433,46 @@ impl<
14231433
self.create_impl(attributes)
14241434
}
14251435
}
1436+
1437+
impl<ServiceType: Service>
1438+
Builder<
1439+
[CustomPayloadMarker],
1440+
CustomHeaderMarker,
1441+
[CustomPayloadMarker],
1442+
CustomHeaderMarker,
1443+
ServiceType,
1444+
>
1445+
{
1446+
#[doc(hidden)]
1447+
pub unsafe fn __internal_set_request_payload_type_details(
1448+
mut self,
1449+
value: &TypeDetail,
1450+
) -> Self {
1451+
self.override_request_payload_type = Some(value.clone());
1452+
self
1453+
}
1454+
1455+
#[doc(hidden)]
1456+
pub unsafe fn __internal_set_response_payload_type_details(
1457+
mut self,
1458+
value: &TypeDetail,
1459+
) -> Self {
1460+
self.override_response_payload_type = Some(value.clone());
1461+
self
1462+
}
1463+
1464+
#[doc(hidden)]
1465+
pub unsafe fn __internal_set_request_header_type_details(mut self, value: &TypeDetail) -> Self {
1466+
self.override_request_header_type = Some(value.clone());
1467+
self
1468+
}
1469+
1470+
#[doc(hidden)]
1471+
pub unsafe fn __internal_set_response_header_type_details(
1472+
mut self,
1473+
value: &TypeDetail,
1474+
) -> Self {
1475+
self.override_response_header_type = Some(value.clone());
1476+
self
1477+
}
1478+
}

0 commit comments

Comments
 (0)