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

Add the ability to write Devices in Rust #105

Merged
merged 11 commits into from
Feb 19, 2025

Conversation

ginnyTheCat
Copy link
Collaborator

@ginnyTheCat ginnyTheCat commented Jan 30, 2025

This allows creating Devices in Rust by implementing the NativeDevice trait and calling the Device::from_native() function.

@ginnyTheCat ginnyTheCat force-pushed the custom_device branch 2 times, most recently from abe3fc7 to 2273ad7 Compare February 6, 2025 03:34
@itsjunetime
Copy link
Collaborator

Are you interested in any sort of help for this feature? I'm also very interested in being able to write devices in rust, so I'd like to help push this through if possible :)

@ginnyTheCat
Copy link
Collaborator Author

ginnyTheCat commented Feb 14, 2025

The branch is already usable, i just need to finish implement all methods. I'm also not sure what the best name is (atm I called the trait CustomDevice but idk if there is sth better).

I will probably finish this PR on Monday.

@ginnyTheCat ginnyTheCat marked this pull request as ready for review February 17, 2025 16:12
Copy link
Collaborator

@itsjunetime itsjunetime left a comment

Choose a reason for hiding this comment

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

This makes sense to me. It's a bit annoying that every device-related function has to be sort of duplicated 3-4 times, but I can't really see a way around it.

@ginnyTheCat
Copy link
Collaborator Author

My main annoyance is that Rust doesn't provide a way to implement impl<T: Trait + ?Sized> Trait for &mut T without writing immense amounts of code just piping the calls through.

Especially as this is a quite common pattern.

Copy link
Owner

@messense messense left a comment

Choose a reason for hiding this comment

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

Thanks!

@messense messense merged commit abf7e45 into messense:main Feb 19, 2025
11 checks passed
@ginnyTheCat ginnyTheCat deleted the custom_device branch February 19, 2025 09:46
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