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

new generic event trait #179

Merged
merged 11 commits into from
May 8, 2024
Merged

new generic event trait #179

merged 11 commits into from
May 8, 2024

Conversation

TTWNO
Copy link
Member

@TTWNO TTWNO commented Apr 18, 2024

Depends on #177

Still TODO before ready:

  • split additional traits out for name+path
  • all but one related trait should be object-safe
    • and enforce with static_assertions (no new deps, we already depend on this)
  • Implement new interfaces on wrapper types.
  • test that event introspection/transparency works correctly.

@TTWNO TTWNO linked an issue Apr 18, 2024 that may be closed by this pull request
Copy link

codecov bot commented Apr 18, 2024

Codecov Report

Attention: Patch coverage is 98.66489% with 10 lines in your changes are missing coverage. Please review.

Project coverage is 85.32%. Comparing base (655be70) to head (37612f7).

Files Patch % Lines
atspi-common/src/macros.rs 90.90% 4 Missing ⚠️
atspi-common/src/events/mod.rs 98.18% 3 Missing ⚠️
atspi-connection/src/lib.rs 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #179      +/-   ##
==========================================
+ Coverage   84.14%   85.32%   +1.17%     
==========================================
  Files          39       39              
  Lines        3097     3386     +289     
==========================================
+ Hits         2606     2889     +283     
- Misses        491      497       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@TTWNO
Copy link
Member Author

TTWNO commented Apr 18, 2024

I just implemented these manually. enum_dispatch is annoying and require it to implement From for you inner types.

@TTWNO TTWNO force-pushed the new-generic-event-trait branch from 6ce4132 to 86c59f0 Compare April 18, 2024 21:27
@TTWNO TTWNO marked this pull request as ready for review April 18, 2024 21:33
@TTWNO TTWNO requested a review from luukvanderduim April 18, 2024 21:33
@TTWNO
Copy link
Member Author

TTWNO commented Apr 18, 2024

For those reviewing:

I'm particularly interested in:

  1. Did I choose the right names.
  2. Are the traits split up in a fashion that makes sense, intuitively.

@TTWNO TTWNO force-pushed the new-generic-event-trait branch from a91966a to 9a33529 Compare April 25, 2024 23:18
TTWNO and others added 11 commits April 25, 2024 18:52
Cargo format

Clippy
1. BusProperties. This contains static information about the DBus properties of a particular event type. This is implemented for indivudal event types only and is NOT object safe; it is similar to GenericEvent, but without path() and sender() functions.
	- DBUS_MEMBER
	- DBUS_INTERFACE
	- MATCH_RULE_STRING
	- REGISTRY_EVENT_STRING
	- type Body
	- build() function
2. EventTypeProperties. This is an object-safe trait that specifies similar data as BusProperties, but as runtime functions instead of constants. This will be implemented on individual event types, and wrapper types like `Event`.
	- member() -> &'static str
	- interface() -> &'static str
	- match_rule() -> &'static str
	- registry_string() -> &'static str
	- EventProperties is blanket implemented for any type that implenents BusPropeties.
3. EventProperties. This is an object-safe trait specifying qualities of a particular event, not its type.
	- name() -> BusName<'_>
	- path() -> ObjectPath<'_>
	- object_ref() -> ObjectRef (auto-impl)

This fixes #176, addresses, at least in part #148.
@TTWNO TTWNO force-pushed the new-generic-event-trait branch from 870af7c to 37612f7 Compare April 26, 2024 00:53
@TTWNO
Copy link
Member Author

TTWNO commented Apr 26, 2024

Forgot that Github's "resolve conflicts" feature merges from main instead of rebasing; solved by a force-pushing.

@TTWNO TTWNO requested a review from DataTriny April 26, 2024 19:22
@TTWNO TTWNO merged commit 596ad05 into main May 8, 2024
13 checks passed
@TTWNO TTWNO deleted the new-generic-event-trait branch May 8, 2024 16:45
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.

More Flexibility with GenericEvent trait
2 participants