Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#195] add sliced api #203

Merged
merged 3 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {

let service = zero_copy::Service::new(&service_name)
.publish_subscribe()
.open_or_create::<usize>()?;
.typed::<usize>()
.open_or_create()?;

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

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

let service = zero_copy::Service::new(&service_name)
.publish_subscribe()
.open_or_create::<usize>()?;
.typed::<usize>()
.open_or_create()?;

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

Expand Down
6 changes: 4 additions & 2 deletions benchmarks/publish-subscribe/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ fn perform_benchmark<T: Service>(iterations: u64) {
.history_size(0)
.subscriber_max_buffer_size(1)
.enable_safe_overflow(true)
.create::<u64>()
.typed::<u64>()
.create()
.unwrap();

let service_b2a = T::new(&service_name_b2a)
Expand All @@ -39,7 +40,8 @@ fn perform_benchmark<T: Service>(iterations: u64) {
.history_size(0)
.subscriber_max_buffer_size(1)
.enable_safe_overflow(true)
.create::<u64>()
.typed::<u64>()
.create()
.unwrap();

let barrier_handle = BarrierHandle::new();
Expand Down
15 changes: 11 additions & 4 deletions doc/release-notes/iceoryx2-unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

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

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

### Workflow

Expand All @@ -36,12 +36,19 @@

### API Breaking Changes

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

```rust
// old
let fuu = hello().is_it_me_you_re_looking_for()
let service = zero_copy::Service::new(&service_name)
.publish_subscribe()
.create::<u64>() // or open::<u64>(), or open_or_create::<u64>()
.unwrap();

// new
let fuu = hypnotoad().all_glory_to_the_hypnotoad()
let service = zero_copy::Service::new(&service_name)
.publish_subscribe()
.typed::<u64>()
.create() // or open(), or open_or_create()
.unwrap();
```
3 changes: 2 additions & 1 deletion examples/examples/complex_data_types/complex_data_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.publish_subscribe()
.max_publishers(16)
.max_subscribers(16)
.open_or_create::<ComplexDataType>()?;
.typed::<ComplexDataType>()
.open_or_create()?;

let publisher = service.publisher().create()?;
let subscriber = service.subscriber().create()?;
Expand Down
3 changes: 2 additions & 1 deletion examples/examples/publish_subscribe/publisher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {

let service = zero_copy::Service::new(&service_name)
.publish_subscribe()
.open_or_create::<TransmissionData>()?;
.typed::<TransmissionData>()
.open_or_create()?;

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

Expand Down
3 changes: 2 additions & 1 deletion examples/examples/publish_subscribe/subscriber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {

let service = zero_copy::Service::new(&service_name)
.publish_subscribe()
.open_or_create::<TransmissionData>()?;
.typed::<TransmissionData>()
.open_or_create()?;

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

Expand Down
3 changes: 2 additions & 1 deletion iceoryx2/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
//!
//! let service = zero_copy::Service::new(&service_name)
//! .publish_subscribe_with_custom_config(&custom_config)
//! .open_or_create::<u64>()?;
//! .typed::<u64>()
//! .open_or_create()?;
//!
//! # Ok(())
//! # }
Expand Down
12 changes: 8 additions & 4 deletions iceoryx2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
//! // create our port factory by creating or opening the service
//! let service = zero_copy::Service::new(&service_name)
//! .publish_subscribe()
//! .open_or_create::<u64>()?;
//! .typed::<u64>()
//! .open_or_create()?;
//!
//! let subscriber = service.subscriber().create()?;
//!
Expand All @@ -94,7 +95,8 @@
//! // create our port factory by creating or opening the service
//! let service = zero_copy::Service::new(&service_name)
//! .publish_subscribe()
//! .open_or_create::<u64>()?;
//! .typed::<u64>()
//! .open_or_create()?;
//!
//! let publisher = service.publisher().create()?;
//!
Expand Down Expand Up @@ -198,7 +200,8 @@
//! .max_subscribers(5)
//! // the maximum amount of publishers of this service
//! .max_publishers(2)
//! .create::<u64>()?;
//! .typed::<u64>()
//! .create()?;
//!
//! # Ok(())
//! # }
Expand Down Expand Up @@ -245,7 +248,8 @@
//! let service = zero_copy::Service::new(&service_name)
//! .publish_subscribe()
//! .enable_safe_overflow(false)
//! .open_or_create::<u64>()?;
//! .typed::<u64>()
//! .open_or_create()?;
//!
//! let publisher = service.publisher()
//! // the maximum amount of samples this publisher can loan in parallel
Expand Down
12 changes: 8 additions & 4 deletions iceoryx2/src/port/publisher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
//! let service_name = ServiceName::new("My/Funk/ServiceName")?;
//! let service = zero_copy::Service::new(&service_name)
//! .publish_subscribe()
//! .open_or_create::<u64>()?;
//! .typed::<u64>()
//! .open_or_create()?;
//!
//! let publisher = service
//! .publisher()
Expand Down Expand Up @@ -591,7 +592,8 @@ impl<Service: service::Service, MessageType: Debug> Publisher<Service, MessageTy
/// #
/// # let service = zero_copy::Service::new(&service_name)
/// # .publish_subscribe()
/// # .open_or_create::<u64>()?;
/// # .typed::<u64>()
/// # .open_or_create()?;
/// #
/// # let publisher = service.publisher().create()?;
///
Expand Down Expand Up @@ -625,7 +627,8 @@ impl<Service: service::Service, MessageType: Debug> Publisher<Service, MessageTy
/// #
/// # let service = zero_copy::Service::new(&service_name)
/// # .publish_subscribe()
/// # .open_or_create::<u64>()?;
/// # .typed::<u64>()
/// # .open_or_create()?;
/// #
/// # let publisher = service.publisher().create()?;
///
Expand Down Expand Up @@ -705,7 +708,8 @@ impl<Service: service::Service, MessageType: Default + Debug> Publisher<Service,
/// #
/// # let service = zero_copy::Service::new(&service_name)
/// # .publish_subscribe()
/// # .open_or_create::<u64>()?;
/// # .typed::<u64>()
/// # .open_or_create()?;
/// #
/// # let publisher = service.publisher().create()?;
///
Expand Down
3 changes: 2 additions & 1 deletion iceoryx2/src/port/subscriber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
//! let service_name = ServiceName::new("My/Funk/ServiceName")?;
//! let service = zero_copy::Service::new(&service_name)
//! .publish_subscribe()
//! .open_or_create::<u64>()?;
//! .typed::<u64>()
//! .open_or_create()?;
//!
//! let subscriber = service.subscriber().create()?;
//!
Expand Down
3 changes: 2 additions & 1 deletion iceoryx2/src/port/update_connections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ pub trait UpdateConnections {
/// #
/// # let service = zero_copy::Service::new(&service_name)
/// # .publish_subscribe()
/// # .open_or_create::<u64>()?;
/// # .typed::<u64>()
/// # .open_or_create()?;
/// #
/// # let publisher = service.publisher().create()?;
///
Expand Down
3 changes: 2 additions & 1 deletion iceoryx2/src/sample.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
//! # let service_name = ServiceName::new("My/Funk/ServiceName")?;
//! # let service = zero_copy::Service::new(&service_name)
//! # .publish_subscribe()
//! # .open_or_create::<u64>()?;
//! # .typed::<u64>()
//! # .open_or_create()?;
//! # let subscriber = service.subscriber().create()?;
//!
//! while let Some(sample) = subscriber.receive()? {
Expand Down
18 changes: 12 additions & 6 deletions iceoryx2/src/sample_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
//! #
//! # let service = zero_copy::Service::new(&service_name)
//! # .publish_subscribe()
//! # .open_or_create::<u64>()?;
//! # .typed::<u64>()
//! # .open_or_create()?;
//! #
//! # let publisher = service.publisher().create()?;
//!
Expand Down Expand Up @@ -99,7 +100,8 @@ impl<MessageType: Debug, Service: crate::service::Service>
/// #
/// # let service = zero_copy::Service::new(&service_name)
/// # .publish_subscribe()
/// # .open_or_create::<u64>()?;
/// # .typed::<u64>()
/// # .open_or_create()?;
/// #
/// # let publisher = service.publisher().create()?;
///
Expand Down Expand Up @@ -133,7 +135,8 @@ impl<MessageType: Debug, Service: crate::service::Service>
/// #
/// # let service = zero_copy::Service::new(&service_name)
/// # .publish_subscribe()
/// # .open_or_create::<u64>()?;
/// # .typed::<u64>()
/// # .open_or_create()?;
/// #
/// # let publisher = service.publisher().create()?;
///
Expand Down Expand Up @@ -169,7 +172,8 @@ impl<
/// #
/// # let service = zero_copy::Service::new(&service_name)
/// # .publish_subscribe()
/// # .open_or_create::<u64>()?;
/// # .typed::<u64>()
/// # .open_or_create()?;
/// # let publisher = service.publisher().create()?;
///
/// let sample = publisher.loan()?;
Expand Down Expand Up @@ -199,7 +203,8 @@ impl<
/// #
/// # let service = zero_copy::Service::new(&service_name)
/// # .publish_subscribe()
/// # .open_or_create::<u64>()?;
/// # .typed::<u64>()
/// # .open_or_create()?;
/// # let publisher = service.publisher().create()?;
///
/// let sample = publisher.loan()?;
Expand Down Expand Up @@ -229,7 +234,8 @@ impl<
/// #
/// # let service = zero_copy::Service::new(&service_name)
/// # .publish_subscribe()
/// # .open_or_create::<u64>()?;
/// # .typed::<u64>()
/// # .open_or_create()?;
/// # let publisher = service.publisher().create()?;
///
/// let mut sample = publisher.loan()?;
Expand Down
Loading