Skip to content

Add a generic Info trait - #12

Merged
bratpiorka merged 9 commits into
oneapi-src:mainfrom
szymon-zadworny:info-refactor
Jul 30, 2026
Merged

Add a generic Info trait#12
bratpiorka merged 9 commits into
oneapi-src:mainfrom
szymon-zadworny:info-refactor

Conversation

@szymon-zadworny

Copy link
Copy Markdown
Contributor

This PR adds:

  • a generic Info trait
  • a prelude with common traits

This PR refactors all current info-type structs to use a common get_info implementation.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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) plus info::InfoTarget with a shared get_info implementation.
  • Refactored existing info-parameter types (platform/device/event info) to implement the new generic Info trait.
  • Added oneapi_rs::prelude and 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 thread oneapi-rs/src/platform.rs
Comment on lines +21 to +23
impl Sealed for Platform {}
impl InfoTarget for Platform {}

Comment thread oneapi-rs/src/event.rs
Comment on lines +29 to +31
impl Sealed for Event {}
impl InfoTarget for Event {}

Comment thread oneapi-rs/src/device.rs
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
bratpiorka merged commit a5ff5b0 into oneapi-src:main Jul 30, 2026
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.

3 participants