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

Rust: ConnectionEvent enum #4786

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

youyuanwu
Copy link
Contributor

Description

Provide a safe ConnectionEvent enum implementation. Added code to convert from ffi ConectionEvent union.
Added StatusCode::from_raw_lossy().
Removed manual ffi code for ConnectionEvent.
Added StreamRef as an none-owning handle wrapper used in ConnectionEvent.

Testing

Changed the existing test to use the new ConnectionEvent enum.

Documentation

NA

@@ -0,0 +1,178 @@
use std::ffi::c_void;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add copyright.

Copy link

codecov bot commented Jan 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.06%. Comparing base (ba795e0) to head (cba58ea).
Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4786      +/-   ##
==========================================
- Coverage   87.38%   86.06%   -1.33%     
==========================================
  Files          56       56              
  Lines       17400    17400              
==========================================
- Hits        15205    14975     -230     
- Misses       2195     2425     +230     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -85,6 +85,19 @@ impl core::fmt::Display for StatusCode {
}
}

impl StatusCode {
/// If the ffi status is unknown/undefined, use not_supported by default.
/// MsQuic returns an undefined status code should not happen ideally,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MsQuic absolutely can return other stays codes from the platform. I think we need a better solution for that.

@nibanks nibanks added the Language: Rust Related to the Rust interop layer label Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Language: Rust Related to the Rust interop layer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants