Add a generic Info trait - #12
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a generic Info/InfoTarget abstraction to unify get_info across platform/device/event, and adds a crate prelude intended to make commonly-used traits easy to import.
Changes:
- Added
info::Info(sealed) plusinfo::InfoTargetwith a sharedget_infoimplementation. - Refactored existing info-parameter types (platform/device/event info) to implement the new generic
Infotrait. - Added
oneapi_rs::preludeand updated examples to use it.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| oneapi-rs/src/prelude.rs | New prelude re-exporting InfoTarget and kernel argument traits/macros. |
| oneapi-rs/src/platform.rs | Switches platform info querying to the new InfoTarget trait. |
| oneapi-rs/src/lib.rs | Exposes the new prelude module. |
| oneapi-rs/src/info/platform-info.rs | Migrates platform info parameter types to the new Info trait. |
| oneapi-rs/src/info/event-info.rs | Migrates event info parameter types to the new Info trait. |
| oneapi-rs/src/info/device-info.rs | Migrates device info parameter types to the new Info trait. |
| oneapi-rs/src/info.rs | Defines the new generic Info and InfoTarget traits. |
| oneapi-rs/src/event.rs | Switches event info querying to the new InfoTarget trait. |
| oneapi-rs/src/device.rs | Switches device info querying to the new InfoTarget trait. |
| oneapi-rs/examples/sycl-ls.rs | Updates example imports to use the new prelude. |
| oneapi-rs/examples/kernel_launch_derive.rs | Updates example imports to use the new prelude. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+21
to
+23
| impl Sealed for Platform {} | ||
| impl InfoTarget for Platform {} | ||
|
|
Comment on lines
+29
to
+31
| impl Sealed for Event {} | ||
| impl InfoTarget for Event {} | ||
|
|
Comment on lines
37
to
39
| /// Returns the associated SYCL platform. | ||
| pub fn get_platform(&self) -> Platform { | ||
| let raw_platform = ffi::get_platform(&self.0); |
bratpiorka
approved these changes
Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds:
This PR refactors all current info-type structs to use a common
get_infoimplementation.