Skip to content

Commit 0b85089

Browse files
authored
Merge pull request #203 from elfenpiff/iox2-195-add-sliced-api
[#195] add sliced api
2 parents 1f15bc0 + 9fdc62f commit 0b85089

28 files changed

+496
-286
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
8989

9090
let service = zero_copy::Service::new(&service_name)
9191
.publish_subscribe()
92-
.open_or_create::<usize>()?;
92+
.typed::<usize>()
93+
.open_or_create()?;
9394

9495
let publisher = service.publisher().create()?;
9596

@@ -116,7 +117,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
116117

117118
let service = zero_copy::Service::new(&service_name)
118119
.publish_subscribe()
119-
.open_or_create::<usize>()?;
120+
.typed::<usize>()
121+
.open_or_create()?;
120122

121123
let subscriber = service.subscriber().create()?;
122124

benchmarks/publish-subscribe/src/main.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ fn perform_benchmark<T: Service>(iterations: u64) {
2929
.history_size(0)
3030
.subscriber_max_buffer_size(1)
3131
.enable_safe_overflow(true)
32-
.create::<u64>()
32+
.typed::<u64>()
33+
.create()
3334
.unwrap();
3435

3536
let service_b2a = T::new(&service_name_b2a)
@@ -39,7 +40,8 @@ fn perform_benchmark<T: Service>(iterations: u64) {
3940
.history_size(0)
4041
.subscriber_max_buffer_size(1)
4142
.enable_safe_overflow(true)
42-
.create::<u64>()
43+
.typed::<u64>()
44+
.create()
4345
.unwrap();
4446

4547
let barrier_handle = BarrierHandle::new();

doc/release-notes/iceoryx2-unreleased.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
<!-- NOTE: Add new entries sorted by issue number to minimize the possibility of conflicts when merging. -->
2222

23-
* Example text [#1](https://github.com/eclipse-iceoryx/iceoryx2/issues/1)
23+
* `open`, `open_or_create` and `create` are untyped in pubsub-builder [#195](https://github.com/eclipse-iceoryx/iceoryx2/issues/195)
2424

2525
### Workflow
2626

@@ -36,12 +36,19 @@
3636

3737
### API Breaking Changes
3838

39-
1. Example
39+
1. `open`, `open_or_create` and `create` are untyped for publish-subscribe services
4040

4141
```rust
4242
// old
43-
let fuu = hello().is_it_me_you_re_looking_for()
43+
let service = zero_copy::Service::new(&service_name)
44+
.publish_subscribe()
45+
.create::<u64>() // or open::<u64>(), or open_or_create::<u64>()
46+
.unwrap();
4447

4548
// new
46-
let fuu = hypnotoad().all_glory_to_the_hypnotoad()
49+
let service = zero_copy::Service::new(&service_name)
50+
.publish_subscribe()
51+
.typed::<u64>()
52+
.create() // or open(), or open_or_create()
53+
.unwrap();
4754
```

examples/examples/complex_data_types/complex_data_types.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
4343
.publish_subscribe()
4444
.max_publishers(16)
4545
.max_subscribers(16)
46-
.open_or_create::<ComplexDataType>()?;
46+
.typed::<ComplexDataType>()
47+
.open_or_create()?;
4748

4849
let publisher = service.publisher().create()?;
4950
let subscriber = service.subscriber().create()?;

examples/examples/publish_subscribe/publisher.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
2121

2222
let service = zero_copy::Service::new(&service_name)
2323
.publish_subscribe()
24-
.open_or_create::<TransmissionData>()?;
24+
.typed::<TransmissionData>()
25+
.open_or_create()?;
2526

2627
let publisher = service.publisher().create()?;
2728

examples/examples/publish_subscribe/subscriber.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
2121

2222
let service = zero_copy::Service::new(&service_name)
2323
.publish_subscribe()
24-
.open_or_create::<TransmissionData>()?;
24+
.typed::<TransmissionData>()
25+
.open_or_create()?;
2526

2627
let subscriber = service.subscriber().create()?;
2728

iceoryx2/src/config.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
//!
2828
//! let service = zero_copy::Service::new(&service_name)
2929
//! .publish_subscribe_with_custom_config(&custom_config)
30-
//! .open_or_create::<u64>()?;
30+
//! .typed::<u64>()
31+
//! .open_or_create()?;
3132
//!
3233
//! # Ok(())
3334
//! # }

iceoryx2/src/lib.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@
6868
//! // create our port factory by creating or opening the service
6969
//! let service = zero_copy::Service::new(&service_name)
7070
//! .publish_subscribe()
71-
//! .open_or_create::<u64>()?;
71+
//! .typed::<u64>()
72+
//! .open_or_create()?;
7273
//!
7374
//! let subscriber = service.subscriber().create()?;
7475
//!
@@ -94,7 +95,8 @@
9495
//! // create our port factory by creating or opening the service
9596
//! let service = zero_copy::Service::new(&service_name)
9697
//! .publish_subscribe()
97-
//! .open_or_create::<u64>()?;
98+
//! .typed::<u64>()
99+
//! .open_or_create()?;
98100
//!
99101
//! let publisher = service.publisher().create()?;
100102
//!
@@ -198,7 +200,8 @@
198200
//! .max_subscribers(5)
199201
//! // the maximum amount of publishers of this service
200202
//! .max_publishers(2)
201-
//! .create::<u64>()?;
203+
//! .typed::<u64>()
204+
//! .create()?;
202205
//!
203206
//! # Ok(())
204207
//! # }
@@ -245,7 +248,8 @@
245248
//! let service = zero_copy::Service::new(&service_name)
246249
//! .publish_subscribe()
247250
//! .enable_safe_overflow(false)
248-
//! .open_or_create::<u64>()?;
251+
//! .typed::<u64>()
252+
//! .open_or_create()?;
249253
//!
250254
//! let publisher = service.publisher()
251255
//! // the maximum amount of samples this publisher can loan in parallel

iceoryx2/src/port/publisher.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
//! let service_name = ServiceName::new("My/Funk/ServiceName")?;
2020
//! let service = zero_copy::Service::new(&service_name)
2121
//! .publish_subscribe()
22-
//! .open_or_create::<u64>()?;
22+
//! .typed::<u64>()
23+
//! .open_or_create()?;
2324
//!
2425
//! let publisher = service
2526
//! .publisher()
@@ -591,7 +592,8 @@ impl<Service: service::Service, MessageType: Debug> Publisher<Service, MessageTy
591592
/// #
592593
/// # let service = zero_copy::Service::new(&service_name)
593594
/// # .publish_subscribe()
594-
/// # .open_or_create::<u64>()?;
595+
/// # .typed::<u64>()
596+
/// # .open_or_create()?;
595597
/// #
596598
/// # let publisher = service.publisher().create()?;
597599
///
@@ -625,7 +627,8 @@ impl<Service: service::Service, MessageType: Debug> Publisher<Service, MessageTy
625627
/// #
626628
/// # let service = zero_copy::Service::new(&service_name)
627629
/// # .publish_subscribe()
628-
/// # .open_or_create::<u64>()?;
630+
/// # .typed::<u64>()
631+
/// # .open_or_create()?;
629632
/// #
630633
/// # let publisher = service.publisher().create()?;
631634
///
@@ -705,7 +708,8 @@ impl<Service: service::Service, MessageType: Default + Debug> Publisher<Service,
705708
/// #
706709
/// # let service = zero_copy::Service::new(&service_name)
707710
/// # .publish_subscribe()
708-
/// # .open_or_create::<u64>()?;
711+
/// # .typed::<u64>()
712+
/// # .open_or_create()?;
709713
/// #
710714
/// # let publisher = service.publisher().create()?;
711715
///

iceoryx2/src/port/subscriber.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
//! let service_name = ServiceName::new("My/Funk/ServiceName")?;
2020
//! let service = zero_copy::Service::new(&service_name)
2121
//! .publish_subscribe()
22-
//! .open_or_create::<u64>()?;
22+
//! .typed::<u64>()
23+
//! .open_or_create()?;
2324
//!
2425
//! let subscriber = service.subscriber().create()?;
2526
//!

iceoryx2/src/port/update_connections.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ pub trait UpdateConnections {
4949
/// #
5050
/// # let service = zero_copy::Service::new(&service_name)
5151
/// # .publish_subscribe()
52-
/// # .open_or_create::<u64>()?;
52+
/// # .typed::<u64>()
53+
/// # .open_or_create()?;
5354
/// #
5455
/// # let publisher = service.publisher().create()?;
5556
///

iceoryx2/src/sample.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
//! # let service_name = ServiceName::new("My/Funk/ServiceName")?;
1919
//! # let service = zero_copy::Service::new(&service_name)
2020
//! # .publish_subscribe()
21-
//! # .open_or_create::<u64>()?;
21+
//! # .typed::<u64>()
22+
//! # .open_or_create()?;
2223
//! # let subscriber = service.subscriber().create()?;
2324
//!
2425
//! while let Some(sample) = subscriber.receive()? {

iceoryx2/src/sample_mut.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
//! #
2020
//! # let service = zero_copy::Service::new(&service_name)
2121
//! # .publish_subscribe()
22-
//! # .open_or_create::<u64>()?;
22+
//! # .typed::<u64>()
23+
//! # .open_or_create()?;
2324
//! #
2425
//! # let publisher = service.publisher().create()?;
2526
//!
@@ -99,7 +100,8 @@ impl<MessageType: Debug, Service: crate::service::Service>
99100
/// #
100101
/// # let service = zero_copy::Service::new(&service_name)
101102
/// # .publish_subscribe()
102-
/// # .open_or_create::<u64>()?;
103+
/// # .typed::<u64>()
104+
/// # .open_or_create()?;
103105
/// #
104106
/// # let publisher = service.publisher().create()?;
105107
///
@@ -133,7 +135,8 @@ impl<MessageType: Debug, Service: crate::service::Service>
133135
/// #
134136
/// # let service = zero_copy::Service::new(&service_name)
135137
/// # .publish_subscribe()
136-
/// # .open_or_create::<u64>()?;
138+
/// # .typed::<u64>()
139+
/// # .open_or_create()?;
137140
/// #
138141
/// # let publisher = service.publisher().create()?;
139142
///
@@ -169,7 +172,8 @@ impl<
169172
/// #
170173
/// # let service = zero_copy::Service::new(&service_name)
171174
/// # .publish_subscribe()
172-
/// # .open_or_create::<u64>()?;
175+
/// # .typed::<u64>()
176+
/// # .open_or_create()?;
173177
/// # let publisher = service.publisher().create()?;
174178
///
175179
/// let sample = publisher.loan()?;
@@ -199,7 +203,8 @@ impl<
199203
/// #
200204
/// # let service = zero_copy::Service::new(&service_name)
201205
/// # .publish_subscribe()
202-
/// # .open_or_create::<u64>()?;
206+
/// # .typed::<u64>()
207+
/// # .open_or_create()?;
203208
/// # let publisher = service.publisher().create()?;
204209
///
205210
/// let sample = publisher.loan()?;
@@ -229,7 +234,8 @@ impl<
229234
/// #
230235
/// # let service = zero_copy::Service::new(&service_name)
231236
/// # .publish_subscribe()
232-
/// # .open_or_create::<u64>()?;
237+
/// # .typed::<u64>()
238+
/// # .open_or_create()?;
233239
/// # let publisher = service.publisher().create()?;
234240
///
235241
/// let mut sample = publisher.loan()?;

0 commit comments

Comments
 (0)