You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an extension to [rquickjs](https://github.com/DelSkayn/rquickjs) to allow the ecosystem to create more unified Rust modules.
6
+
This is a complement to [rquickjs](https://github.com/DelSkayn/rquickjs) to allow the ecosystem to create more unified Rust extensions.
7
7
8
-
The goal was to create a better version of [`ModuleDef`](https://docs.rs/rquickjs/latest/rquickjs/module/trait.ModuleDef.html) that would allow it to have options as input and set global.
8
+
The goal was to create a more generic version of [`ModuleDef`](https://docs.rs/rquickjs/latest/rquickjs/module/trait.ModuleDef.html) that would allow it to have options and/or set global values.
9
9
10
-
For example, a `fetch`module using `ModuleDefExt` could set a global `fetch` function and have as options an allowlist of domains.
10
+
For example, a `fetch`extension could set a global `fetch` function and have as options an allowlist of domains.
11
11
12
-
## Using modules
12
+
## Using extensions
13
13
14
-
If you are a consumer of modules create using that crate, here is how you can import them in your runtime.
14
+
If you are a consumer of extensions created using that crate, here is how you can import them in your runtime.
15
15
16
16
```rust
17
17
userquickjs::AsyncRuntime;
18
-
userquickjs_module::ModuleLoader;
18
+
userquickjs_extension::ExtensionBuilder;
19
19
20
20
#[tokio::main]
21
21
asyncfnmain() {
22
22
letrt=AsyncRuntime::new().unwrap();
23
23
24
-
let (loader, resolver, initalizer) =ModuleLoader::builder().with_module(MyModule).build();
24
+
let (loader, resolver, initalizer) =ExtensionBuilder::new().with_module(MyExtension).build();
25
25
26
26
rt.set_loader(resolver, loader).await;
27
27
@@ -36,37 +36,37 @@ async fn main() {
36
36
}
37
37
```
38
38
39
-
## Creating modules
39
+
## Creating extensions
40
40
41
-
For the base case, replace the `ModuleDef` by an implementation of `ModuleDefExt`.
41
+
For the base case, replace the `ModuleDef` by an implementation of `Extension`.
0 commit comments