Skip to content

Commit

Permalink
Merge pull request #65 from elfenpiff/iox2-64-api-qol
Browse files Browse the repository at this point in the history
[#64] Implement Display for MessagingPattern
  • Loading branch information
elfenpiff authored Jan 2, 2024
2 parents 26d979e + a2b9d92 commit c3622ca
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
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))
.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

0 comments on commit c3622ca

Please sign in to comment.