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 more ergonomic usage of Buffer protocol with SIMPLE flag. #90

Open
gatesn opened this issue Sep 12, 2023 · 1 comment
Open

Add more ergonomic usage of Buffer protocol with SIMPLE flag. #90

gatesn opened this issue Sep 12, 2023 · 1 comment

Comments

@gatesn
Copy link
Contributor

gatesn commented Sep 12, 2023

PyBUF_SIMPLE is a flag used to denote a buffer is a pure 1-dimensional contiguous unsigned u8 array.

This is a pretty common use-case, so we should make it close to trivial to map back and forth to Zig []u8.

In fact, we could support quite a lot of the 1-dimensional buffer protocol using comptime.

  • []u8 -> writable simple
  • []u32 -> writable, check format string, check alignment, etc.
  • []const u32 -> readonly, etc.
@delta003
Copy link
Member

Related -> #29

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

No branches or pull requests

2 participants