Skip to content

RFC: Drop rustler::wrapper - #768

Merged
filmor merged 1 commit into
masterfrom
drop-wrapper
Sep 29, 2026
Merged

filmor merged 1 commit into
masterfrom
drop-wrapper

Conversation

@filmor

@filmor filmor commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

Instead of using the intermediate half-safe function layer, we use the
enif_* functions now directly in the high level functions.

From a cursory github search, this affects the following codebases:

Could you explain what you exactly drop down to rustler::wrapper functions for? Can the same be achieved through direct usage of rustler::sys or with a proper safe wrapper that simply doesn't exist yet?

Instead of using the intermediate half-safe function layer, we use the
`enif_*` functions now directly in the high level functions.
@filmor filmor changed the title Drop rustler::wrapper RFC: Drop rustler::wrapper Sep 23, 2026
rubas added a commit to rubas/exmpeg that referenced this pull request Sep 23, 2026
…pointer (#86)

ProgressEmitter and CancelGuard now borrow the calling NIF's Env<'a>
instead of a raw NIF_ENV pointer. This removes the last use of
rustler::wrapper, which rusterlium/rustler#768 deletes, and drops
ffi_helpers::reconstruct_env, a safe function that returned an Env with
an arbitrary lifetime. No behavior change.

Co-authored-by: Dominic Rubas <1042243+rubas@users.noreply.github.com>
@rubas

rubas commented Sep 23, 2026

Copy link
Copy Markdown

exmpeg used rustler::wrapper::NIF_ENV only to keep the calling NIF's env in a struct without a lifetime parameter. It sends progress messages and checks caller liveness from a dirty NIF. We now store Env<'a> directly (rubas/exmpeg#86), so we do not need wrapper. Dropping it is fine for us.

@Qqwy

Qqwy commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

#456 made the usage of rustler::wrapper superfluous for rustler_elixir_fun but I never ended up upstreaming the change until it was merged. @filmor was quicker than me to create such a PR now after opening this issue (Qqwy/elixir-rustler_elixir_fun#13). Thanks a lot for your help, and thank you very very much for your excellent work on Rustler!

@akoutmos

Copy link
Copy Markdown

Thanks for the heads up and for all your hard work! Made the appropriate changes in Explorer elixir-explorer/explorer#1164. When CI goes green I'll merge it in!

@filmor
filmor marked this pull request as ready for review September 25, 2026 07:09
@filmor
filmor requested a review from a team September 29, 2026 11:09
@filmor
filmor merged commit c42d64c into master Sep 29, 2026
83 checks passed
@filmor
filmor deleted the drop-wrapper branch September 29, 2026 20:02
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.

5 participants