jeffutter
jeffutter7d ago

Missing `init_ops_and_esm` function for extensions in rust

Hi there, I'm just getting started with Deno and trying to embed it in rust. I'm using deno_core 0.344.0 and deno_console 0.204.0. The docs for deno_console (and most docs about extensions) reference calling init_opts_and_esm like deno_console::deno_console::init_ops_and_esm() but this function doesn't seem to exist. I can't seem to find where it is defined, it's not in the deno repo or any cargo docs. I find the same on an extension that I create with extension as well. There is an init function . However, when I try to use that I get a panic like:
thread 'main' panicked at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/deno_core-0.344.0/runtime/jsruntime.rs:750:9:
Failed to initialize a JsRuntime: Following modules were not evaluated; make sure they are imported from other code:
- ext:deno_console/01_console.js

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/deno_core-0.344.0/runtime/jsruntime.rs:750:9:
Failed to initialize a JsRuntime: Following modules were not evaluated; make sure they are imported from other code:
- ext:deno_console/01_console.js

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
That happens before I can run any js code to import the module. Any idea what I'm doing wrong here?
3 Replies
jeffutter
jeffutterOP7d ago
Oh, that makes some sense then. But I"m still not clear on how to resolve the error I get when I use init instead. It says the module needs to be imported.. but it panics before I can run code that imports it
marvinh.
marvinh.7d ago
I'm afraid I can't help further as I've never embedded parts of Deno in another Rust app

Did you find this page helpful?