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

2.18 Context Features #52

Merged
merged 13 commits into from
Sep 13, 2024
Merged

2.18 Context Features #52

merged 13 commits into from
Sep 13, 2024

Conversation

BrettMayson
Copy link
Owner

@BrettMayson BrettMayson commented Sep 12, 2024

  • Request the context only when used in a function
  • Use call context types directly instead of strings
  • Support requesting the call stack

Alternative to #51, this is a more intrusive change, will require changes to any extensions that were using the call context, but provides the best of both in terms of performance

// No longer has access to call context
fn command(ctx: Context) {}

// Access to call context
fn command(call_ctx: CallContext) {
  call_ctx.source();
  call_ctx.stack_trace(); // Won't compile
}

// Access to call context and stack
fn command(call_ctx: CallContextStackTrace) {
  call_ctx.source();
  call_ctx.stack_trace(); // Will compile
}

// Context is still separate
fn command(ctx: Context, call_ctx: CallContext) {}

Copy link

codecov bot commented Sep 12, 2024

Codecov Report

Attention: Patch coverage is 66.47727% with 118 lines in your changes missing coverage. Please review.

Project coverage is 87.7%. Comparing base (7a01445) to head (1b9e188).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
arma-rs/src/call_context/call.rs 60.4% 55 Missing ⚠️
arma-rs/src/call_context/stack.rs 0.0% 31 Missing ⚠️
arma-rs/src/command.rs 46.6% 16 Missing ⚠️
arma-rs-example/src/call_context.rs 60.8% 9 Missing ⚠️
arma-rs/src/flags.rs 86.4% 5 Missing ⚠️
arma-rs/src/lib.rs 96.4% 2 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
arma-rs-proc/src/lib.rs 100.0% <100.0%> (ø)
arma-rs/src/call_context/manager.rs 100.0% <100.0%> (ø)
arma-rs/src/context/mod.rs 91.3% <ø> (-0.8%) ⬇️
arma-rs/src/group.rs 100.0% <100.0%> (+1.4%) ⬆️
arma-rs/src/testing.rs 83.6% <100.0%> (+0.5%) ⬆️
arma-rs/src/lib.rs 96.7% <96.4%> (-1.4%) ⬇️
arma-rs/src/flags.rs 86.4% <86.4%> (ø)
arma-rs-example/src/call_context.rs 74.4% <60.8%> (-25.6%) ⬇️
arma-rs/src/command.rs 73.5% <46.6%> (+2.5%) ⬆️
arma-rs/src/call_context/stack.rs 0.0% <0.0%> (ø)
... and 1 more

... and 15 files with indirect coverage changes

@BrettMayson BrettMayson marked this pull request as ready for review September 13, 2024 02:24
@BrettMayson
Copy link
Owner Author

"ace" callExtension ["break_line", ["alpha bravo charlie"]];

master:
0.0209422 ms

with this PR:
0.00146789 ms

@BrettMayson BrettMayson merged commit f97ee75 into main Sep 13, 2024
14 of 16 checks passed
@BrettMayson BrettMayson deleted the 218 branch September 13, 2024 22:20
@PabstMirror
Copy link

This seems to be CTD on non-profiling 2.16 (win 64)
nothing in rpt
I know profiling branch had some of the 2.18 features

@BrettMayson
Copy link
Owner Author

I can fix it for non 2.18 soon

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