eclipse-iceoryx / eclipse-iceoryx/iceoryx2

Do not force fluent API on the user

Open
#1,973 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
2.6k
Forks
187
Avg merge
1d 23h
Merged PRs (30d)
47

Description

Fluent API is cumbersome when loading service configuration from e.g. a json file and setting values at run time.

## (Code) Example Of Cumbersome API

```c++
auto max_publishers = max_publishers_default_value;
if(...) //
max_publishers =
// Repeat for each QoS setting...

auto service = node_->service_builder(service_name)
.publish_subscribe>()
.max_nodes(max_nodes)
.max_publishers(max_publishers)
// etc...
.open_or_create();
```

## Improvement Suggestion
```c++
auto service =
node_->service_builder(service_name).publish_subscribe>()

if(...) // Check if there's a configured MaxPublishers for this Topic
service.max_publishers(...) // Set to the user-specified value, otherwise implicilty use the default value
```

## Solution proposal

Allowing storage of the temporary object only requires to remove `&&` in a few files.

Contributor guide

Open the contributing guide

Research direction

Start at the service_builder entry point and trace how the temporary service object is returned and how its fluent configuration methods are defined. Check the related files where temporary-object && usage is mentioned, then verify that configuration can be loaded and applied after construction while unspecified settings retain their defaults.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, rust
Domain
api, developer-experience
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.