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

Clearly document lifetime requirements on SQE arguments #29

Open
withoutboats opened this issue Dec 22, 2019 · 1 comment
Open

Clearly document lifetime requirements on SQE arguments #29

withoutboats opened this issue Dec 22, 2019 · 1 comment

Comments

@withoutboats
Copy link
Collaborator

Any argument to an SQE prep method which is a reference (e.g. buffers, the mutable references in prep_accept) must outlive the completion of the IO event that is being prepared. There's no way to directly express this lifetime, as the completion of the IO is dynamic and unpredictable. This is the core reason these prep APIs are marked unsafe.

Users of iou are responsible for guaranteeing that these values will not be invalidated until after the completion occurs. We should provide clear, precise, and comprehensible documentation about the safety requirements of these methods.

@Nugine
Copy link

Nugine commented Jan 22, 2021

Would it be better to use a raw pointer (*mut [u8]) instead of a reference (&'unknown mut [u8])?

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