{"id":15683729,"url":"https://github.com/littledivy/rusty_esm","last_synced_at":"2025-05-07T14:12:37.781Z","repository":{"id":103502375,"uuid":"414917621","full_name":"littledivy/rusty_esm","owner":"littledivy","description":"Example of executing ES module exports from Rust","archived":false,"fork":false,"pushed_at":"2021-10-15T16:47:18.000Z","size":64,"stargazers_count":10,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-07T14:12:28.600Z","etag":null,"topics":["deno","hacktoberfest","runtime","rust","serde","v8"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/littledivy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-08T09:05:30.000Z","updated_at":"2023-04-22T14:20:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"dc64f3cc-fa97-477d-8d76-fce04f207145","html_url":"https://github.com/littledivy/rusty_esm","commit_stats":{"total_commits":15,"total_committers":3,"mean_commits":5.0,"dds":"0.19999999999999996","last_synced_commit":"c3bfb8041635a7f068aae725def44cf05adba7a6"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/littledivy%2Frusty_esm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/littledivy%2Frusty_esm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/littledivy%2Frusty_esm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/littledivy%2Frusty_esm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/littledivy","download_url":"https://codeload.github.com/littledivy/rusty_esm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252892504,"owners_count":21820648,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deno","hacktoberfest","runtime","rust","serde","v8"],"created_at":"2024-10-03T17:08:23.015Z","updated_at":"2025-05-07T14:12:37.762Z","avatar_url":"https://github.com/littledivy.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"## rusty_esm\n\nThis is an example showcasing a common use case for embedding Deno - calling JS\nmodule exports from Rust. The rest is pretty self explainatory:\n\n```rust\n// main.rs\n#[derive(Debug, Deserialize)]\nstruct ApiResponse {\n  user_id: isize,\n  id: isize,\n  title: String,\n  completed: bool,\n}\n\nlet mut rt = Runtime::new(\"testdata/basic.js\").await?;\nlet id = 5;\nlet value: ApiResponse = rt.call(\"getStuff\", \u0026[id]).await?;\n```\n\n```javascript\n// testdata/basic.js\nexport async function getStuff(id) {\n  const r = await fetch(\"https://jsonplaceholder.typicode.com/todos/\" + id);\n  return await r.json();\n}\n```\n\n```sh\n$ target/debug/deno_embed\nApiResponse {\n    user_id: 0,\n    id: 5,\n    title: \"laboriosam mollitia et enim quasi adipisci quia provident illum\",\n    completed: false,\n}\n```\n\n### Benchmarks\n\nMeasured for `Runtime::call` in example scenarios. See `src/main.rs`.\n\n```shell\ntest tests::bench_call         ... bench:       4,429 ns/iter (+/- 1,139)\ntest tests::bench_call_promise ... bench:       4,609 ns/iter (+/- 306)\n```\n\n#### License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flittledivy%2Frusty_esm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flittledivy%2Frusty_esm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flittledivy%2Frusty_esm/lists"}