Skip to content

Commit

Permalink
[eclipse-iceoryx#195] Remove variant builder
Browse files Browse the repository at this point in the history
  • Loading branch information
elfenpiff committed Apr 25, 2024
1 parent 67ce663 commit 3915f84
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
6 changes: 3 additions & 3 deletions iceoryx2/src/service/builder/publish_subscribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use iceoryx2_cal::dynamic_storage::DynamicStorageCreateError;
use iceoryx2_cal::serialize::Serialize;
use iceoryx2_cal::static_storage::StaticStorageLocked;

use self::type_details::{TypeDetails, TypeVariantBuilder};
use self::type_details::{TypeDetails, TypeVariant};

use super::ServiceState;

Expand Down Expand Up @@ -239,7 +239,7 @@ impl<ServiceType: service::Service> Builder<ServiceType> {
/// Returns the [`TypedBuilder`] to create a typed [`Service`].
pub fn typed<MessageType: Debug>(mut self) -> TypedBuilder<MessageType, ServiceType> {
self.config_details_mut().type_details =
TypeDetails::from::<MessageType, Header>(TypeVariantBuilder::<MessageType>::new());
TypeDetails::from::<MessageType, Header>(TypeVariant::FixedSize);

TypedBuilder {
builder: self,
Expand All @@ -250,7 +250,7 @@ impl<ServiceType: service::Service> Builder<ServiceType> {
/// Returns the [`SlicedBuilder`] to create a slice typed [`Service`].
pub fn sliced<MessageType: Debug>(mut self) -> SlicedBuilder<MessageType, ServiceType> {
self.config_details_mut().type_details =
TypeDetails::from::<MessageType, Header>(TypeVariantBuilder::<[MessageType]>::new());
TypeDetails::from::<MessageType, Header>(TypeVariant::Dynamic);

SlicedBuilder {
builder: self,
Expand Down
18 changes: 1 addition & 17 deletions iceoryx2/src/service/static_config/type_details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
// SPDX-License-Identifier: Apache-2.0 OR MIT

use std::{alloc::Layout, marker::PhantomData};
use std::alloc::Layout;

use iceoryx2_bb_elementary::math::align;
use serde::{Deserialize, Serialize};
Expand All @@ -21,22 +21,6 @@ pub enum TypeVariant {
Dynamic,
}

pub(crate) struct TypeVariantBuilder<T: ?Sized> {
_data: PhantomData<T>,
}

impl<T> TypeVariantBuilder<T> {
pub(crate) fn new() -> TypeVariant {
TypeVariant::FixedSize
}
}

impl<T> TypeVariantBuilder<[T]> {
pub(crate) fn new() -> TypeVariant {
TypeVariant::Dynamic
}
}

#[derive(Debug, Clone, Eq, Hash, PartialEq, Serialize, Deserialize)]
pub struct TypeDetails {
pub variant: TypeVariant,
Expand Down

0 comments on commit 3915f84

Please sign in to comment.