eclipse-iceoryx / eclipse-iceoryx/iceoryx2
Do not force fluent API on the user
- 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
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