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

Use global API table instead of each handle's having table ptr. #4708

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

masa-koz
Copy link
Contributor

Description

This pull request includes several changes to the src/lib.rs file and an update to the Cargo.toml file. The primary focus is on removing the table pointer from various structs and centralizing the API table management using a static API instance. Additionally, the ctor crate is introduced for constructor and destructor functions to manage the API lifecycle.

Testing

cargo test

Documentation

No

@masa-koz masa-koz requested a review from a team as a code owner December 13, 2024 12:36
Cargo.toml Outdated Show resolved Hide resolved
pub static mut API: Api = Api { table: ptr::null() };

#[ctor::ctor]
fn open_msquic() {
Copy link
Member

Choose a reason for hiding this comment

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

It's unclear what calls this and when. Is this effectively called at DLL load (on Windows)?

Copy link
Member

Choose a reason for hiding this comment

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

Is there a way to make this lazy initialized (when the first registration is created) instead of a global init?

src/lib.rs Outdated Show resolved Hide resolved
masa-koz and others added 2 commits December 13, 2024 21:51
Copy link

codecov bot commented Dec 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.06%. Comparing base (d337a3c) to head (8747e8e).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4708      +/-   ##
==========================================
+ Coverage   85.64%   86.06%   +0.42%     
==========================================
  Files          56       56              
  Lines       17363    17363              
==========================================
+ Hits        14871    14944      +73     
+ Misses       2492     2419      -73     

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

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

Successfully merging this pull request may close these issues.

2 participants