From 5d49071615a6dcf7e2b99647ca3fca7ac9220618 Mon Sep 17 00:00:00 2001 From: Christian Eltzschig Date: Tue, 9 Jul 2024 18:07:14 +0200 Subject: [PATCH] [#270] Add release note; adjust documentation --- README.md | 10 +++++----- doc/release-notes/iceoryx2-unreleased.md | 16 ++++++++++++++++ iceoryx2/src/lib.rs | 8 ++++---- iceoryx2/src/node/mod.rs | 2 +- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 5b9852c21..9fe0e4516 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ fn main() -> Result<(), Box> { let publisher = service.publisher_builder().create()?; - while let Iox2Event::Tick = Iox2::wait(CYCLE_TIME) { + while let NodeEvent::Tick = node.wait(CYCLE_TIME) { let sample = publisher.loan_uninit()?; let sample = sample.write_payload(1234); sample.send()?; @@ -123,7 +123,7 @@ fn main() -> Result<(), Box> { let subscriber = service.subscriber_builder().create()?; - while let Iox2Event::Tick = Iox2::wait(CYCLE_TIME) { + while let NodeEvent::Tick = node.wait(CYCLE_TIME) { while let Some(sample) = subscriber.receive()? { println!("received: {:?}", *sample); } @@ -172,7 +172,7 @@ fn main() -> Result<(), Box> { let notifier = event.notifier_builder().create()?; let id = EventId::new(12); - while let Iox2Event::Tick = Iox2::wait(CYCLE_TIME) { + while let NodeEvent::Tick = node.wait(CYCLE_TIME) { notifier.notify_with_custom_event_id(id)?; println!("Trigger event with id {:?} ...", id); @@ -199,7 +199,7 @@ fn main() -> Result<(), Box> { let listener = event.listener_builder().create()?; - while let Iox2Event::Tick = Iox2::wait(Duration::ZERO) { + while let NodeEvent::Tick = node.wait(Duration::ZERO) { if let Ok(Some(event_id)) = listener.timed_wait_one(CYCLE_TIME) { println!("event was triggered with id: {:?}", event_id); } @@ -226,7 +226,7 @@ fn main() -> Result<(), Box> { let listener = event.listener_builder().create()?; - while let Iox2Event::Tick = Iox2::wait(Duration::ZERO) { + while let NodeEvent::Tick = node.wait(Duration::ZERO) { listener.timed_wait_all( |event_id| { println!("event was triggered with id: {:?}", event_id); diff --git a/doc/release-notes/iceoryx2-unreleased.md b/doc/release-notes/iceoryx2-unreleased.md index d585bc607..4c1b530c0 100644 --- a/doc/release-notes/iceoryx2-unreleased.md +++ b/doc/release-notes/iceoryx2-unreleased.md @@ -76,6 +76,7 @@ * Updated all dependencies and increased MSRV to 1.75 [#221](https://github.com/eclipse-iceoryx/iceoryx2/issues/221) * Remove `Service::does_exist_with_custom_config` and `Service::list_with_custom_config` [#238](https://github.com/eclipse-iceoryx/iceoryx2/issues/238) * Renamed `PortFactory::{publisher|subscriber|listener|notifier}` to `PortFactory::{publisher|subscriber|listener|notifier}_builder` [#244](https://github.com/eclipse-iceoryx/iceoryx2/issues/244) + * Merged `Iox2::wait` with new `Node` and removed `Iox2` [#270](https://github.com/eclipse-iceoryx/iceoryx2/issues/270) ### Workflow @@ -355,3 +356,18 @@ pubsub_service.static_config().max_subscriber(); ``` +17. `Iox2::wait()` is part of the `Node`, `Iox2Event` renamed to `NodeEvent` + + ```rust + // old + while let Iox2Event::Tick = Iox2::wait(CYCLE_TIME) { + // main loop stuff + } + + // new + let node = NodeBuilder::new().create::()?; + while let NodeEvent::Tick = node.wait(CYCLE_TIME) { + // main loop stuff + } + ``` + diff --git a/iceoryx2/src/lib.rs b/iceoryx2/src/lib.rs index 963186cf2..c26516c4e 100644 --- a/iceoryx2/src/lib.rs +++ b/iceoryx2/src/lib.rs @@ -75,7 +75,7 @@ //! //! let subscriber = service.subscriber_builder().create()?; //! -//! while let Iox2Event::Tick = Iox2::wait(CYCLE_TIME) { +//! while let NodeEvent::Tick = node.wait(CYCLE_TIME) { //! while let Some(sample) = subscriber.receive()? { //! println!("received: {:?}", *sample); //! } @@ -102,7 +102,7 @@ //! //! let publisher = service.publisher_builder().create()?; //! -//! while let Iox2Event::Tick = Iox2::wait(CYCLE_TIME) { +//! while let NodeEvent::Tick = node.wait(CYCLE_TIME) { //! let sample = publisher.loan_uninit()?; //! let sample = sample.write_payload(1234); //! sample.send()?; @@ -135,7 +135,7 @@ //! //! let mut listener = event.listener_builder().create()?; //! -//! while let Iox2Event::Tick = Iox2::wait(Duration::ZERO) { +//! while let NodeEvent::Tick = node.wait(Duration::ZERO) { //! if let Ok(Some(event_id)) = listener.timed_wait_one(CYCLE_TIME) { //! println!("event was triggered with id: {:?}", event_id); //! } @@ -163,7 +163,7 @@ //! let notifier = event.notifier_builder().create()?; //! //! let mut counter: usize = 0; -//! while let Iox2Event::Tick = Iox2::wait(CYCLE_TIME) { +//! while let NodeEvent::Tick = node.wait(CYCLE_TIME) { //! counter += 1; //! notifier.notify_with_custom_event_id(EventId::new(counter))?; //! diff --git a/iceoryx2/src/node/mod.rs b/iceoryx2/src/node/mod.rs index 29ec33982..4673cf61e 100644 --- a/iceoryx2/src/node/mod.rs +++ b/iceoryx2/src/node/mod.rs @@ -623,7 +623,7 @@ impl Node { } /// Waits until an event was received. It returns - /// [`Iox2Event::Tick`] when the `cycle_time` has passed, otherwise event that occurred. + /// [`NodeEvent::Tick`] when the `cycle_time` has passed, otherwise event that occurred. pub fn wait(&self, cycle_time: Duration) -> NodeEvent { if SignalHandler::termination_requested() { return NodeEvent::TerminationRequest;