feat: add consistent raw pointer access across wrapper types#328
Open
revmischa wants to merge 1 commit into
Open
feat: add consistent raw pointer access across wrapper types#328revmischa wants to merge 1 commit into
revmischa wants to merge 1 commit into
Conversation
revmischa
force-pushed
the
feat/raw-pointer-access
branch
2 times, most recently
from
February 2, 2026 05:59
9db36f7 to
3081aad
Compare
Add `raw()` getters and `unsafe fn from_raw()` constructors to wrapper types that were missing them, enabling users to interoperate with raw SDL APIs when the safe abstractions don't cover their use case. Changes: - AudioStream: add raw(), from_raw(), deprecate stream() - AudioStreamWithCallback: add Deref/DerefMut to expose AudioStream methods, remove redundant forwarding methods (now handled by Deref) - Joystick, Gamepad, Sensor, Haptic, Cursor: add raw() and from_raw() - Palette, Texture: add from_raw() (raw() already exists) - Sampler: make raw() public (was private) - FPSManager: add raw() and from_raw() Safety improvements: - Add debug_assert null checks to all from_raw() implementations - Fix Joystick::drop to always call SDL_CloseJoystick (was conditional on connected() status, which could leak resources) Closes #326 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
revmischa
force-pushed
the
feat/raw-pointer-access
branch
from
February 2, 2026 06:09
3081aad to
d7cccae
Compare
Contributor
|
I also think there are a bunch of functions from_ll and to_ll What is the reason for their names being _ll? |
Member
Author
This was carried over from sdl2-rs. I assume it means low-level |
maxwoolfdev
approved these changes
Apr 14, 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.
Addresses #326
Adds
raw()andunsafe fn from_raw()to wrapper types that were missing them, so users can interop with raw SDL when needed.Types updated:
AudioStream,Joystick,Gamepad,Sensor,Haptic,Cursor,Palette,Texture,Sampler,FPSManagerAlso:
AudioStreamWithCallbacknow implementsDeref<Target=AudioStream>so all stream methods are accessibleJoystick::dropto always close (was skipping disconnected joysticks, leaking resources)debug_assertnull checks infrom_raw()for easier debuggingCloses #326