1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
//! gpuikit
//!
//! A comprehensive UI component library for GPUI applications.
//!
//! # Quick Start
//!
//! ```no_run
//! use gpui::Application;
//! use gpuikit::init;
//!
//! fn main() {
//! Application::with_platform(gpui_platform::current_platform(false))
//! .with_assets(gpuikit::assets())
//! .run(|cx| {
//! init(cx);
//! // ... your app code
//! });
//! }
//! ```
//!
//! The platform comes from `gpui_platform`, which your app depends on
//! alongside `gpui` — gpuikit does not re-export either. `false` asks for a
//! real windowing platform rather than a headless one.
//!
//! # Feature Flags
//!
//! All features are off by default.
//!
//! - `editor` — the editor component, and the syntect-backed syntax
//! highlighting markdown code fences use once an app calls
//! `markdown::init_code_highlighting` (itself gated on this feature)
//! - `stitch` — closes the syntax a partially streamed markdown document leaves
//! open (`**bold`, `[label](htt`) before parsing, so streaming text does not
//! flicker between literal markers and styled text. Pulls in
//! [mdstitch](https://docs.rs/mdstitch), which **requires Rust 1.95**;
//! [`markdown::preprocessing_available`] reports which build you got
//! - `runtime_shaders` — compiles Metal shaders at runtime rather than at build
//! time, so a macOS build needs no Xcode Metal toolchain
//! - `schema` — adds the `schemars` dependency. Nothing here derives
//! `JsonSchema` yet, so today this only affects your dependency graph
//!
//! # Minimum Rust version
//!
//! This crate declares `rust-version = "1.85"`, which is a statement about its
//! own source — async closures, and edition 2024 — rather than a guarantee
//! about a whole build. Edition 2024 selects cargo's v3 resolver, which unlike
//! v2 does take that floor into account: when it picks a *new* version of a
//! dependency it prefers one whose own `rust-version` fits. That is a
//! preference, not a wall, and it says nothing about the versions `Cargo.lock`
//! already names — several of those declare more (cosmic-text and smol_str
//! 1.89, oo7 1.92 on Linux), so on a toolchain near 1.85 you will most likely
//! meet one of theirs first. A recent stable is the practical answer.
//!
//! The `stitch` feature raises gpuikit's own floor to **1.95**. It is the only
//! one that does.
use App;
use RustEmbed;
// Core modules
// Feature-gated editor module
pub use Icons as DefaultIcons;
/// Tests for the release workflows' version guard — that the version either of
/// them would publish is the one `CHANGELOG.md` names. `release.yml` computes
/// the version; `release-deploy.yml` is the one that runs `cargo publish`, and
/// it is reachable without `release.yml` having run at all, so both carry it.
///
/// No runtime code, and nothing outside a test build: the module exists
/// because `cargo test --lib` is the only thing in this repository that can
/// check a workflow before it runs for real. See its own docs.
/// Tests for the rule that keeps a workflow's outside values out of its shell
/// — no `${{ }}` inside a `run:` body, and free-form values judged in a step of
/// their own before anything uses them.
///
/// No runtime code, and nothing outside a test build. Covers every workflow in
/// `.github/workflows/`, which a test enforces by reading the directory. See
/// its own docs.
/// Tests for the build configuration that keeps `ld` from being OOM-killed
/// while linking this crate's eight examples — the dev profile's debug level,
/// Linux's `split-debuginfo`, and the `examples` feature every `[[example]]`
/// requires.
///
/// No runtime code, and nothing outside a test build. One test reads
/// `examples/` from disk, because a new undeclared file there is autodiscovered
/// as a target and cannot carry `required-features`. See its own docs.
/// Tests for the rule that this crate creates no thread it cannot join — no
/// `smol` / `async-io` dependency, no `smol::` or `async_io::` in the source,
/// and the two delays (cursor blink, toast auto-dismiss) scheduled on gpui's
/// `BackgroundExecutor::timer`.
///
/// No runtime code, and nothing outside a test build. The `async-io` thread's
/// `main_loop` has no exit path, so it raced process teardown and aborted a
/// fully green `cargo test --lib` (#190). See its own docs.
/// Tests for the rule that a rustdoc example which is not checked does not
/// exist — no `` ```ignore `` anywhere in `src/`, and `no_run` only with a
/// reason on record. rustdoc never compiles an `ignore`d block, so the crate's
/// own Quick Start went on naming `Application::new()` long after that
/// function stopped existing.
///
/// No runtime code, and nothing outside a test build. Its docs carry the
/// hidden prelude a new example should copy.
/// Tests for the rule that runtime code stays runnable on
/// `wasm32-unknown-unknown` — no `std::time::Instant`/`SystemTime`,
/// `std::fs`, or `std::thread::spawn` outside an explicit allowlist of
/// native-only APIs and test-only code. These compile for wasm and then
/// panic or error in the browser, which no local `cargo test` would catch.
///
/// No runtime code, and nothing outside a test build. See its own docs, and
/// <https://github.com/iamnbutler/gpuikit-demo> for gpuikit running on wasm.
/// Embedded assets for gpuikit (icons, fonts, etc.)
;
/// Returns the gpuikit asset source, for `Application::with_assets`.
///
/// # Example
/// ```no_run
/// # use gpui::Application;
/// Application::with_platform(gpui_platform::current_platform(false))
/// .with_assets(gpuikit::assets())
/// .run(|cx| {
/// gpuikit::init(cx);
/// // ...
/// });
/// ```
/// Initialize gpuikit - sets up themes and global state.
///
/// This must be called as soon as possible after your `gpui::Application` is created.
/// Make sure to also call `.with_assets(gpuikit::Assets)` on your Application.
///
/// # Panics
/// Calling a gpuikit component before initialization will panic.