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

[#64] Implement Display for MessagingPattern #65

Merged
merged 3 commits into from
Jan 2, 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
2 changes: 1 addition & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
* [ ] Android
* [x] Linux
* [x] Windows
* [ ] Mac Os
* [x] Mac Os
* [ ] iOS
* [ ] WatchOS
* [x] FreeBSD
Expand Down
3 changes: 2 additions & 1 deletion doc/release-notes/iceoryx2-unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

### Bugfixes

* Example [#1](https://github.com/eclipse-iceoryx/iceoryx2/issues/1)
* Fix suffix of static config [#66](https://github.com/eclipse-iceoryx/iceoryx2/issues/66)

### Refactoring

Expand All @@ -25,6 +25,7 @@

* Add `FixedSizeByteString::from_bytes_truncated` [#56](https://github.com/eclipse-iceoryx/iceoryx2/issues/56)
* Add `Deref`, `DerefMut`, `Clone`, `Eq`, `PartialEq` and `extend_from_slice` to (FixedSize)Vec [#58](https://github.com/eclipse-iceoryx/iceoryx2/issues/58)
* `MessagingPattern` implements `Display` [#64](https://github.com/eclipse-iceoryx/iceoryx2/issues/64)

### API Breaking Changes

Expand Down
4 changes: 2 additions & 2 deletions iceoryx2-bb/posix/tests/udp_socket_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ fn udp_socket_when_socket_goes_out_of_scope_address_is_free_again() {
fn udp_socket_server_has_correct_address() {
let sut_server = UdpServerBuilder::new()
.address(ipv4_address::LOCALHOST)
.port(Port::new(65111))
.port(Port::new(55223))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing for this PR and I think you already did it somewhere else but using an atomic base port number an atomically increasing it for each test will make these tests more robust.

.listen()
.unwrap();

assert_that!(sut_server.address(), eq ipv4_address::LOCALHOST);
assert_that!(sut_server.port(), eq Port::new(65111));
assert_that!(sut_server.port(), eq Port::new(55223));
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion iceoryx2/src/service/config_scheme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub(crate) fn static_config_storage_config<'config, Service: crate::service::Det
generate_default_config::<<Service::StaticStorage as NamedConceptMgmt>::Configuration>(
"static_config_storage_config",
&global_config.global.prefix,
&global_config.global.service.dynamic_config_storage_suffix,
&global_config.global.service.static_config_storage_suffix,
&path_hint,
)
}
Expand Down
11 changes: 11 additions & 0 deletions iceoryx2/src/service/messaging_pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
//! [`Listener`](crate::port::listener::Listener)s.
//!
//! **Note:** This does **not** send or receive POSIX signals nor is it based on them.
use std::fmt::Display;

use crate::service::static_config::event;
use crate::service::static_config::publish_subscribe;
use serde::{Deserialize, Serialize};
Expand All @@ -44,6 +46,15 @@ pub enum MessagingPattern {
Event(event::StaticConfig),
}

impl Display for MessagingPattern {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
MessagingPattern::Event(_) => write!(f, "Event"),
MessagingPattern::PublishSubscribe(_) => write!(f, "PublishSubscribe"),
}
}
}

impl From<MessagingPattern> for u32 {
fn from(value: MessagingPattern) -> Self {
match value {
Expand Down