-
Notifications
You must be signed in to change notification settings - Fork 546
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
Rust: Migrate to use ffi QUIC_API_TABLE #4756
base: main
Are you sure you want to change the base?
Rust: Migrate to use ffi QUIC_API_TABLE #4756
Conversation
Thanks for following up on the error type! :) |
match event.event_type { | ||
crate::STREAM_EVENT_START_COMPLETE => { | ||
println!("Stream start complete 0x{:x}", unsafe { | ||
event.payload.start_complete.status |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not specific to this PR, but why is accessing event.payload.start_complete.status
considered unsafe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
payload is a union type. Rust union is for ffi only (without metadata), and the compiler has no way to check if the access is safe. However, Rust enum has metadata embedded in it so enum is safe. I have another branch that does the union to enum conversion (in unsafe code).
Description
This is the beginning of a series of PRs to migrate from manually written code to use auto generated Rust ffi bindings, and make Rust APIs safe in default, and handles ffi internally in the crate.
This PR changes the following:
The migration process will break the compatibility of the APIs but this is ok as msquic rust crate is experimental.
Testing
Existing rust test.
More tests will be added once we establish the Rust safe APIs.
Documentation
NA