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 try_as_raw_ptr/as_raw_ptr implementations for Symbol to convert to raw pointer #154

Merged
merged 1 commit into from
Jul 20, 2024
Merged

Add try_as_raw_ptr/as_raw_ptr implementations for Symbol to convert to raw pointer #154

merged 1 commit into from
Jul 20, 2024

Conversation

AlexanderSchuetz97
Copy link
Contributor

see #153

@nagisa
Copy link
Owner

nagisa commented Jul 15, 2024

Sorry this took a while to get back to. I think I would still rather have plain inherent methods for the time being over trying to anticipate what the implementations of TryInto/From might look like in the future. An especially difficult part here is the type Error = (). I would go for Infallible for these platforms, but even then it isn't particularly ergonomic from the perspective of the users who don't care about "those other platforms".

Let me know if you don't have time or desire to modify the PR, I'll try to find time for it myself in that case.

@AlexanderSchuetz97
Copy link
Contributor Author

AlexanderSchuetz97 commented Jul 15, 2024

Ill do it until the end of the week.

I will go for making it a method then that returns Option. As of now it would always yield Some. I would call it try_as_raw_ptr() on Symbol and as_raw_ptr that returns the rawptr directly on win::Symbol and unix::Symbol. is that okay for you? the future wasi::Symbol would just not have the as_raw_ptr fn in the future and would return None for the crate::Symbol call. This way you dont need an error type. You could still later add try_into_raw_ptr with a proper Error enum should that be necesarry. The option fn i would add now would then be for the case where the library user cares not for the type of failure. That should be forward compatible for ever.

Please tell me if you agree or what I should change for my suggestion so I can begin.

@AlexanderSchuetz97 AlexanderSchuetz97 changed the title Add TryFrom/TryInto implementations for Symbol to convert to raw pointer Add try_as_raw_ptr/as_raw_ptr implementations for Symbol to convert to raw pointer Jul 20, 2024
@AlexanderSchuetz97
Copy link
Contributor Author

AlexanderSchuetz97 commented Jul 20, 2024

I have updated the PR please review
@nagisa

@nagisa nagisa merged commit f6c0d28 into nagisa:master Jul 20, 2024
13 of 22 checks passed
@AlexanderSchuetz97
Copy link
Contributor Author

Thank you!

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.

2 participants