|
| 1 | +# gosub_engine |
| 2 | + |
| 3 | +The primary public API of the Gosub browser engine — the crate you depend on to build a |
| 4 | +user agent or embed the engine. It ties the parser, CSS, layout, and rendering crates |
| 5 | +together behind an async, channel-driven surface: the engine emits `EngineEvent`s, and |
| 6 | +the embedder drives it with `EngineCommand` (engine/zone level) and `TabCommand` (per |
| 7 | +tab, via `TabHandle`). Work in progress; not yet production-ready. |
| 8 | + |
| 9 | +## The model |
| 10 | + |
| 11 | +- **`GosubEngine`** — create, `start()`/`run()`, `subscribe_events()`, `create_zone()`. |
| 12 | +- **Zones** — separate profiles. Each `Zone` owns its cookie jar and storage isolation; |
| 13 | + tabs live inside a zone. |
| 14 | +- **Tabs** — browsing contexts driven through `TabHandle`; per-tab runtime state |
| 15 | + (DOM, render pipeline caches) lives in a `BrowsingContext`. |
| 16 | +- **`EngineConfig`** — set-once engine configuration via `EngineConfig::builder()`; |
| 17 | + the dynamic settings store (`default_settings()`, backed by `gosub_config`) handles |
| 18 | + runtime-changeable values. |
| 19 | +- **`DefaultRenderConfig<Backend, FontSystem, Sink>`** — the zero-sized marker type that |
| 20 | + wires the standard `gosub_html5` + `gosub_css3` stack to your chosen render backend and |
| 21 | + font system. The default is headless (`NullBackend` + `ParleyFontSystem`). |
| 22 | + |
| 23 | +## What lives here |
| 24 | + |
| 25 | +| Area | Contents | |
| 26 | +|------|----------| |
| 27 | +| `engine/` | `GosubEngine`, zones, tabs, events, `BrowsingContext`, UA policy, settings store | |
| 28 | +| `net` | The engine side of networking: dedicated Tokio I/O thread, routing and content decisions, streaming bodies. The fetcher core is the external [gosub-sonar](https://github.com/gosub-io/gosub-sonar) crate | |
| 29 | +| `cookies` | `CookieJar` with in-memory, JSON, and SQLite stores (feature `sqlite_cookie_store`, on by default) | |
| 30 | +| `storage` | localStorage/sessionStorage services with partitioning policies | |
| 31 | +| `resource_pipeline` | Per-asset-kind fetch/parse pipelines (html, css, js, image, font) | |
| 32 | +| `html` | `DefaultRenderConfig`, `RenderConfiguration`, document parsing entry points | |
| 33 | + |
| 34 | +Other features: `metrics` (engine metrics module), `ui_eframe` / `winit` / `wayland` / |
| 35 | +`x11` (GUI-toolkit integration glue). |
| 36 | + |
| 37 | +## Getting started |
| 38 | + |
| 39 | +Start from [`examples/hello-world.rs`](../../examples/hello-world.rs), then the |
| 40 | +[tutorial](../../docs/tutorial.md). The headless path is documented in |
| 41 | +[docs/headless.md](../../docs/headless.md) with `gosub-screenshot` as the reference. |
| 42 | + |
| 43 | +## Further reading |
| 44 | + |
| 45 | +- [docs/tutorial.md](../../docs/tutorial.md) — engine / zone / tab concepts, first integration |
| 46 | +- [docs/zones-and-tabs.md](../../docs/zones-and-tabs.md) — the runtime model |
| 47 | +- [docs/configuration.md](../../docs/configuration.md) — choosing backend and font system |
| 48 | +- [docs/cookies.md](../../docs/cookies.md), [docs/datastores.md](../../docs/datastores.md) — isolation and persistence |
| 49 | +- [docs/network/](../../docs/network/) — the networking architecture |
| 50 | +- [docs/resource-pipeline.md](../../docs/resource-pipeline.md) — async resource loading |
0 commit comments