{"id":13503092,"url":"https://github.com/fitzgen/dodrio","last_synced_at":"2025-09-28T21:30:46.769Z","repository":{"id":54257434,"uuid":"159237509","full_name":"fitzgen/dodrio","owner":"fitzgen","description":"A fast, bump-allocated virtual DOM library for Rust and WebAssembly.","archived":true,"fork":false,"pushed_at":"2021-03-01T06:20:06.000Z","size":713,"stargazers_count":1241,"open_issues_count":26,"forks_count":49,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-01-01T10:35:30.730Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://docs.rs/dodrio","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fitzgen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-26T21:50:59.000Z","updated_at":"2024-11-18T13:57:59.000Z","dependencies_parsed_at":"2022-08-13T10:10:47.024Z","dependency_job_id":null,"html_url":"https://github.com/fitzgen/dodrio","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fitzgen%2Fdodrio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fitzgen%2Fdodrio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fitzgen%2Fdodrio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fitzgen%2Fdodrio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fitzgen","download_url":"https://codeload.github.com/fitzgen/dodrio/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234563136,"owners_count":18853060,"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":[],"created_at":"2024-07-31T22:02:36.779Z","updated_at":"2025-09-28T21:30:46.219Z","avatar_url":"https://github.com/fitzgen.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# Dodrio\n\nA fast, bump-allocated virtual DOM library for Rust and WebAssembly. Note that\nDodrio is still **experimental**.\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n\n- [Warning](#warning)\n- [Examples](#examples)\n- [Design](#design)\n  - [Bump Allocation](#bump-allocation)\n  - [Change List as Stack Machine](#change-list-as-stack-machine)\n  - [Library — Not Framework](#library--not-framework)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Warning\n\nI reiterate that Dodrio is in a very **experimental** state. It probably has\nbugs, and no one is using it in production.\n\n## Examples\n\nHere is the classic \"Hello, World!\" example:\n\n```rust\nstruct Hello {\n    who: String,\n}\n\nimpl Render for Hello {\n    fn render\u003c'a\u003e(\u0026self, cx: \u0026mut RenderContext\u003ca\u003e) -\u003e Node\u003c'a\u003e {\n        let who = bumpalo::format!(in cx.bump, \"Hello, {}!\", self.who);\n        div(cx)\n            .children([text(who.into_bump_str())])\n            .finish()\n    }\n}\n```\n\nMore examples can be found in [the `examples`\ndirectory](https://github.com/fitzgen/dodrio/tree/master/examples), including:\n\n* [`counter`](https://github.com/fitzgen/dodrio/tree/master/examples/counter):\n  Incrementing and decrementing a counter.\n* [`input-form`](https://github.com/fitzgen/dodrio/tree/master/examples/input-form):\n  Reading an `\u003cinput\u003e` and displaying its contents.\n* [`todomvc`](https://github.com/fitzgen/dodrio/tree/master/examples/todomvc):\n  An implementation of the infamous TodoMVC application.\n* [`moire`](https://github.com/fitzgen/dodrio/tree/master/examples/moire): The\n  WebRender Moiré patterns demo.\n* [`game-of-life`](https://github.com/fitzgen/dodrio/tree/master/examples/game-of-life):\n  The Rust and WebAssembly book's Game of Life tutorial rendered with Dodrio\n  instead of to 2D canvas.\n* [`js-component`](https://github.com/fitzgen/dodrio/tree/master/examples/js-component):\n  Defines a rendering component in JavaScript with the `dodrio-js-api` crate.\n\n## Cargo Features\n\n* `log` \u0026mdash; enable debugging-oriented log messages with the `log` crate's\n  facade. You still have to initialize a logger for the messages to go anywhere,\n  such as [`console_log`](https://github.com/iamcodemaker/console_log).\n\n* `serde` \u0026mdash; enable `serde::{Serialize, Deserialize}` implementations for\n  `Cached\u003cR\u003e` where `R` is serializable and deserializable.\n\n## Design\n\n### Bump Allocation\n\nBump allocation is essentially the fastest method of allocating objects. It has\nconstraints, but works particularly well when allocation lifetimes match program\nphases. And virtual DOMs are very phase oriented.\n\nDodrio maintains three bump allocation arenas:\n\n1. The newest, most up-to-date virtual DOM. The virtual DOM nodes themselves and\n   any temporary containers needed while creating them are allocated into this\n   arena.\n2. The previous virtual DOM. This reflects the current state of the physical\n   DOM.\n3. The difference between (1) and (2). This is a sequence of DOM mutation\n   operations — colloquially known as a \"change list\" — which if applied to\n   the physical DOM, will make the physical DOM match (1).\n\nRendering happens as follows:\n\n1. The application state is rendered into bump allocation arena (1).\n2. (1) is diffed with (2) and the changes are emitted into (3).\n3. JavaScript code applies the change list in (3) to the physical DOM.\n4. (1) and (2) are swapped, double-buffering style, and the new (1) has its bump\n   allocation pointer reset, as does (3).\n5. Rinse and repeat.\n\n### Change List as Stack Machine\n\nThe change list that represents the difference between how the physical DOM\ncurrently looks, and our ideal virtual DOM state is encoded in a tiny stack\nmachine language. A stack machine works particularly well for applying DOM\ndiffs, a task that is essentially a tree traversal.\n\n### Library — Not Framework\n\nDodrio is just a library. (And did I mention it is experimental?!) It is not a\nfull-fledged, complete, batteries-included solution for all frontend Web\ndevelopment. And it never intends to become that either.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffitzgen%2Fdodrio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffitzgen%2Fdodrio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffitzgen%2Fdodrio/lists"}