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

fix(zenoh-flow-nodes): provide accessors on LinkMessage #256

Merged
merged 1 commit into from
Jun 4, 2024

Conversation

J-Loudet
Copy link
Contributor

@J-Loudet J-Loudet commented Jun 4, 2024

Writing the Python bindings highlighted a tiny nuisance of the Deref trait: in order to access a Payload, an explicit turbofished call to Deref was required, which was not particularly ergonomic.

This commit introduces accessors for both the payload and timestamp fields of a LinkMessage.

The method get_timestamp was deprecated in favour of timestamp. This change is purely aesthetic and for coherence purposes.

  • zenoh-flow-nodes/src/messages.rs:
    • removed the implementation of the Deref trait,
    • added an accessor payload(),
    • added an accessor timestamp(),
    • deprecated the accessor get_timestamp() in favour of timestamp().
  • zenoh-flow-runtime/src/runners/builtin/zenoh/sink.rs: as the Deref trait is no longer implemented on LinkMessage, a call to payload() is required.

Writing the Python bindings highlighted a tiny nuisance of the `Deref`
trait: in order to access a Payload, an explicit turbofished call to
Deref was required, which was not particularly ergonomic.

This commit introduces accessors for both the `payload` and `timestamp`
fields of a `LinkMessage`.

The method `get_timestamp` was deprecated in favour of `timestamp`. This
change is purely aesthetic and for coherence purposes.

* zenoh-flow-nodes/src/messages.rs:
  - removed the implementation of the Deref trait,
  - added an accessor `payload()`,
  - added an accessor `timestamp()`,
  - deprecated the accessor `get_timestamp()` in favour of
    `timestamp()`.
* zenoh-flow-runtime/src/runners/builtin/zenoh/sink.rs: as the Deref
  trait is no longer implemented on `LinkMessage`, a call to `payload()`
  is required.

Signed-off-by: Julien Loudet <julien.loudet@zettascale.tech>
@J-Loudet J-Loudet merged commit be9f4df into main Jun 4, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant