chore: Update GPUI 2025/03/20 and fix spawn method. (#725)

- Update `resvg`, `usvg` to 0.45.0
This commit is contained in:
Jason Lee 2025-03-20 21:23:50 +08:00 committed by GitHub
parent c98e4f0521
commit a89f971108
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 230 additions and 119 deletions

235
Cargo.lock generated
View file

@ -101,9 +101,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.92"
version = "1.0.97"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74f37166d7d48a0284b99dd824694c26119c700b53bf0d1540cdb147dbdaaf13"
checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f"
[[package]]
name = "arbitrary"
@ -561,7 +561,7 @@ dependencies = [
"bitflags 2.6.0",
"cexpr",
"clang-sys",
"itertools 0.10.5",
"itertools 0.11.0",
"lazy_static",
"lazycell",
"log",
@ -584,7 +584,7 @@ dependencies = [
"bitflags 2.6.0",
"cexpr",
"clang-sys",
"itertools 0.10.5",
"itertools 0.11.0",
"log",
"prettyplease",
"proc-macro2",
@ -1105,7 +1105,7 @@ dependencies = [
[[package]]
name = "collections"
version = "0.1.0"
source = "git+https://github.com/huacnlee/zed.git?branch=webview#deac3307cea9c32c4571a3fe797555593c9efaef"
source = "git+https://github.com/huacnlee/zed.git?branch=webview#064bc875f23528152a8e7db481a9eaefca955f1e"
dependencies = [
"indexmap 2.7.1",
"rustc-hash 2.1.0",
@ -1554,7 +1554,7 @@ dependencies = [
[[package]]
name = "derive_refineable"
version = "0.1.0"
source = "git+https://github.com/huacnlee/zed.git?branch=webview#deac3307cea9c32c4571a3fe797555593c9efaef"
source = "git+https://github.com/huacnlee/zed.git?branch=webview#064bc875f23528152a8e7db481a9eaefca955f1e"
dependencies = [
"proc-macro2",
"quote",
@ -2020,14 +2020,16 @@ dependencies = [
[[package]]
name = "fontdb"
version = "0.22.0"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3a6f9af55fb97ad673fb7a69533eb2f967648a06fa21f8c9bb2cd6d33975716"
checksum = "457e789b3d1202543297a350643cf459f836cade38934e7a4cf6a39e7cde2905"
dependencies = [
"fontconfig-parser",
"log",
"memmap2",
"slotmap",
"tinyvec",
"ttf-parser 0.24.1",
"ttf-parser 0.25.1",
]
[[package]]
@ -2557,7 +2559,7 @@ dependencies = [
[[package]]
name = "gpui"
version = "0.1.0"
source = "git+https://github.com/huacnlee/zed.git?branch=webview#deac3307cea9c32c4571a3fe797555593c9efaef"
source = "git+https://github.com/huacnlee/zed.git?branch=webview#064bc875f23528152a8e7db481a9eaefca955f1e"
dependencies = [
"anyhow",
"as-raw-xcb-connection",
@ -2623,7 +2625,7 @@ dependencies = [
"strum",
"sum_tree",
"taffy",
"thiserror 1.0.66",
"thiserror 2.0.12",
"usvg",
"util",
"uuid",
@ -2633,8 +2635,8 @@ dependencies = [
"wayland-cursor",
"wayland-protocols",
"wayland-protocols-plasma",
"windows",
"windows-core 0.58.0",
"windows 0.60.0",
"windows-core 0.60.1",
"x11-clipboard",
"x11rb",
"xim",
@ -2675,7 +2677,7 @@ dependencies = [
[[package]]
name = "gpui_macros"
version = "0.1.0"
source = "git+https://github.com/huacnlee/zed.git?branch=webview#deac3307cea9c32c4571a3fe797555593c9efaef"
source = "git+https://github.com/huacnlee/zed.git?branch=webview#064bc875f23528152a8e7db481a9eaefca955f1e"
dependencies = [
"proc-macro2",
"quote",
@ -2943,7 +2945,7 @@ dependencies = [
[[package]]
name = "http_client"
version = "0.1.0"
source = "git+https://github.com/huacnlee/zed.git?branch=webview#deac3307cea9c32c4571a3fe797555593c9efaef"
source = "git+https://github.com/huacnlee/zed.git?branch=webview#064bc875f23528152a8e7db481a9eaefca955f1e"
dependencies = [
"anyhow",
"bytes",
@ -2951,13 +2953,20 @@ dependencies = [
"futures",
"http",
"log",
"rustls",
"rustls-platform-verifier",
"serde",
"serde_json",
"url",
]
[[package]]
name = "http_client_tls"
version = "0.1.0"
source = "git+https://github.com/huacnlee/zed.git?branch=webview#064bc875f23528152a8e7db481a9eaefca955f1e"
dependencies = [
"rustls",
"rustls-platform-verifier",
]
[[package]]
name = "httparse"
version = "1.10.0"
@ -3682,7 +3691,7 @@ dependencies = [
[[package]]
name = "media"
version = "0.1.0"
source = "git+https://github.com/huacnlee/zed.git?branch=webview#deac3307cea9c32c4571a3fe797555593c9efaef"
source = "git+https://github.com/huacnlee/zed.git?branch=webview#064bc875f23528152a8e7db481a9eaefca955f1e"
dependencies = [
"anyhow",
"bindgen 0.70.1",
@ -5000,7 +5009,7 @@ dependencies = [
"rustc-hash 2.1.0",
"rustls",
"socket2 0.5.8",
"thiserror 2.0.11",
"thiserror 2.0.12",
"tokio",
"tracing",
]
@ -5019,7 +5028,7 @@ dependencies = [
"rustls",
"rustls-pki-types",
"slab",
"thiserror 2.0.11",
"thiserror 2.0.12",
"tinyvec",
"tracing",
"web-time",
@ -5291,7 +5300,7 @@ dependencies = [
[[package]]
name = "refineable"
version = "0.1.0"
source = "git+https://github.com/huacnlee/zed.git?branch=webview#deac3307cea9c32c4571a3fe797555593c9efaef"
source = "git+https://github.com/huacnlee/zed.git?branch=webview#064bc875f23528152a8e7db481a9eaefca955f1e"
dependencies = [
"derive_refineable",
]
@ -5384,12 +5393,13 @@ dependencies = [
[[package]]
name = "reqwest_client"
version = "0.1.0"
source = "git+https://github.com/huacnlee/zed.git?branch=webview#deac3307cea9c32c4571a3fe797555593c9efaef"
source = "git+https://github.com/huacnlee/zed.git?branch=webview#064bc875f23528152a8e7db481a9eaefca955f1e"
dependencies = [
"anyhow",
"bytes",
"futures",
"http_client",
"http_client_tls",
"log",
"regex",
"reqwest",
@ -5400,9 +5410,9 @@ dependencies = [
[[package]]
name = "resvg"
version = "0.44.0"
version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a325d5e8d1cebddd070b13f44cec8071594ab67d1012797c121f27a669b7958"
checksum = "dd43d1c474e9dadf09a8fdf22d713ba668b499b5117b9b9079500224e26b5b29"
dependencies = [
"log",
"pico-args",
@ -5723,18 +5733,18 @@ dependencies = [
[[package]]
name = "rustybuzz"
version = "0.18.0"
version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c85d1ccd519e61834798eb52c4e886e8c2d7d698dd3d6ce0b1b47eb8557f1181"
checksum = "fd3c7c96f8a08ee34eff8857b11b49b07d71d1c3f4e88f8a88d4c9e9f90b1702"
dependencies = [
"bitflags 2.6.0",
"bytemuck",
"core_maths",
"log",
"smallvec",
"ttf-parser 0.24.1",
"unicode-bidi-mirroring 0.3.0",
"unicode-ccc 0.3.0",
"ttf-parser 0.25.1",
"unicode-bidi-mirroring 0.4.0",
"unicode-ccc 0.4.0",
"unicode-properties",
"unicode-script",
]
@ -5858,7 +5868,7 @@ checksum = "d369a96f978623eb3dc28807c4852d6cc617fed53da5d3c400feff1ef34a714a"
[[package]]
name = "semantic_version"
version = "0.1.0"
source = "git+https://github.com/huacnlee/zed.git?branch=webview#deac3307cea9c32c4571a3fe797555593c9efaef"
source = "git+https://github.com/huacnlee/zed.git?branch=webview#064bc875f23528152a8e7db481a9eaefca955f1e"
dependencies = [
"anyhow",
"serde",
@ -6325,7 +6335,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]]
name = "sum_tree"
version = "0.1.0"
source = "git+https://github.com/huacnlee/zed.git?branch=webview#deac3307cea9c32c4571a3fe797555593c9efaef"
source = "git+https://github.com/huacnlee/zed.git?branch=webview#064bc875f23528152a8e7db481a9eaefca955f1e"
dependencies = [
"arrayvec",
"log",
@ -6418,9 +6428,9 @@ checksum = "20e16a0f46cf5fd675563ef54f26e83e20f2366bcf027bcb3cc3ed2b98aaf2ca"
[[package]]
name = "svgtypes"
version = "0.15.2"
version = "0.15.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "794de53cc48eaabeed0ab6a3404a65f40b3e38c067e4435883a65d2aa4ca000e"
checksum = "68c7541fff44b35860c1a7a47a7cadf3e4a304c457b58f9870d9706ece028afc"
dependencies = [
"kurbo",
"siphasher 1.0.1",
@ -6625,11 +6635,11 @@ dependencies = [
[[package]]
name = "thiserror"
version = "2.0.11"
version = "2.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc"
checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708"
dependencies = [
"thiserror-impl 2.0.11",
"thiserror-impl 2.0.12",
]
[[package]]
@ -6645,9 +6655,9 @@ dependencies = [
[[package]]
name = "thiserror-impl"
version = "2.0.11"
version = "2.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2"
checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d"
dependencies = [
"proc-macro2",
"quote",
@ -6928,9 +6938,9 @@ checksum = "2c591d83f69777866b9126b24c6dd9a18351f177e49d625920d19f989fd31cf8"
[[package]]
name = "ttf-parser"
version = "0.24.1"
version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5be21190ff5d38e8b4a2d3b6a3ae57f612cc39c96e83cedeaf7abc338a8bac4a"
checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31"
dependencies = [
"core_maths",
]
@ -6978,9 +6988,9 @@ checksum = "23cb788ffebc92c5948d0e997106233eeb1d8b9512f93f41651f52b6c5f5af86"
[[package]]
name = "unicode-bidi-mirroring"
version = "0.3.0"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64af057ad7466495ca113126be61838d8af947f41d93a949980b2389a118082f"
checksum = "5dfa6e8c60bb66d49db113e0125ee8711b7647b5579dc7f5f19c42357ed039fe"
[[package]]
name = "unicode-ccc"
@ -6990,9 +7000,9 @@ checksum = "1df77b101bcc4ea3d78dafc5ad7e4f58ceffe0b2b16bf446aeb50b6cb4157656"
[[package]]
name = "unicode-ccc"
version = "0.3.0"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "260bc6647b3893a9a90668360803a15f96b85a5257b1c3a0c3daf6ae2496de42"
checksum = "ce61d488bcdc9bc8b5d1772c404828b17fc481c0a582b5581e95fb233aef503e"
[[package]]
name = "unicode-id"
@ -7083,20 +7093,20 @@ dependencies = [
[[package]]
name = "usvg"
version = "0.44.0"
version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7447e703d7223b067607655e625e0dbca80822880248937da65966194c4864e6"
checksum = "2ac8e0e3e4696253dc06167990b3fe9a2668ab66270adf949a464db4088cb354"
dependencies = [
"base64",
"data-url 0.3.1",
"flate2",
"fontdb 0.22.0",
"fontdb 0.23.0",
"imagesize",
"kurbo",
"log",
"pico-args",
"roxmltree",
"rustybuzz 0.18.0",
"rustybuzz 0.20.1",
"simplecss",
"siphasher 1.0.1",
"strict-num",
@ -7117,7 +7127,7 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
[[package]]
name = "util"
version = "0.1.0"
source = "git+https://github.com/huacnlee/zed.git?branch=webview#deac3307cea9c32c4571a3fe797555593c9efaef"
source = "git+https://github.com/huacnlee/zed.git?branch=webview#064bc875f23528152a8e7db481a9eaefca955f1e"
dependencies = [
"anyhow",
"async-fs 2.1.2",
@ -7528,10 +7538,10 @@ checksum = "823e7ebcfaea51e78f72c87fc3b65a1e602c321f407a0b36dbb327d7bb7cd921"
dependencies = [
"webview2-com-macros",
"webview2-com-sys",
"windows",
"windows 0.58.0",
"windows-core 0.58.0",
"windows-implement",
"windows-interface",
"windows-implement 0.58.0",
"windows-interface 0.58.0",
]
[[package]]
@ -7552,7 +7562,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a82bce72db6e5ee83c68b5de1e2cd6ea195b9fbff91cb37df5884cbe3222df4"
dependencies = [
"thiserror 1.0.66",
"windows",
"windows 0.58.0",
"windows-core 0.58.0",
]
@ -7615,6 +7625,28 @@ dependencies = [
"windows-targets 0.52.6",
]
[[package]]
name = "windows"
version = "0.60.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddf874e74c7a99773e62b1c671427abf01a425e77c3d3fb9fb1e4883ea934529"
dependencies = [
"windows-collections",
"windows-core 0.60.1",
"windows-future",
"windows-link",
"windows-numerics",
]
[[package]]
name = "windows-collections"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5467f79cc1ba3f52ebb2ed41dbb459b8e7db636cc3429458d9a852e15bc24dec"
dependencies = [
"windows-core 0.60.1",
]
[[package]]
name = "windows-core"
version = "0.52.0"
@ -7630,13 +7662,36 @@ version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99"
dependencies = [
"windows-implement",
"windows-interface",
"windows-result",
"windows-strings",
"windows-implement 0.58.0",
"windows-interface 0.58.0",
"windows-result 0.2.0",
"windows-strings 0.1.0",
"windows-targets 0.52.6",
]
[[package]]
name = "windows-core"
version = "0.60.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca21a92a9cae9bf4ccae5cf8368dce0837100ddf6e6d57936749e85f152f6247"
dependencies = [
"windows-implement 0.59.0",
"windows-interface 0.59.1",
"windows-link",
"windows-result 0.3.2",
"windows-strings 0.3.1",
]
[[package]]
name = "windows-future"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a787db4595e7eb80239b74ce8babfb1363d8e343ab072f2ffe901400c03349f0"
dependencies = [
"windows-core 0.60.1",
"windows-link",
]
[[package]]
name = "windows-implement"
version = "0.58.0"
@ -7648,6 +7703,17 @@ dependencies = [
"syn 2.0.96",
]
[[package]]
name = "windows-implement"
version = "0.59.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83577b051e2f49a058c308f17f273b570a6a758386fc291b5f6a934dd84e48c1"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.96",
]
[[package]]
name = "windows-interface"
version = "0.58.0"
@ -7659,14 +7725,41 @@ dependencies = [
"syn 2.0.96",
]
[[package]]
name = "windows-interface"
version = "0.59.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.96",
]
[[package]]
name = "windows-link"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38"
[[package]]
name = "windows-numerics"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "005dea54e2f6499f2cee279b8f703b3cf3b5734a2d8d21867c8f44003182eeed"
dependencies = [
"windows-core 0.60.1",
"windows-link",
]
[[package]]
name = "windows-registry"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0"
dependencies = [
"windows-result",
"windows-strings",
"windows-result 0.2.0",
"windows-strings 0.1.0",
"windows-targets 0.52.6",
]
@ -7679,16 +7772,34 @@ dependencies = [
"windows-targets 0.52.6",
]
[[package]]
name = "windows-result"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252"
dependencies = [
"windows-link",
]
[[package]]
name = "windows-strings"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
dependencies = [
"windows-result",
"windows-result 0.2.0",
"windows-targets 0.52.6",
]
[[package]]
name = "windows-strings"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319"
dependencies = [
"windows-link",
]
[[package]]
name = "windows-sys"
version = "0.45.0"
@ -7999,12 +8110,12 @@ dependencies = [
"sha2",
"soup3",
"tao-macros",
"thiserror 2.0.11",
"thiserror 2.0.12",
"url",
"webkit2gtk",
"webkit2gtk-sys",
"webview2-com",
"windows",
"windows 0.58.0",
"windows-core 0.58.0",
"windows-version",
"x11-dl",

View file

@ -217,7 +217,7 @@ impl StoryTiles {
cx: &mut Context<Self>,
) {
let dock_area = dock_area.clone();
self._save_layout_task = Some(cx.spawn(|this, cx| async move {
self._save_layout_task = Some(cx.spawn(async move |this, cx| {
Timer::after(Duration::from_secs(10)).await;
let _ = cx.update(|cx| {
@ -266,9 +266,9 @@ impl StoryTiles {
);
let weak_dock_area = dock_area.downgrade();
cx.spawn_in(window, |this, mut window| async move {
cx.spawn_in(window, async move |this, window| {
if answer.await == Ok(0) {
_ = this.update_in(&mut window, |_, window, cx| {
_ = this.update_in(window, |_, window, cx| {
Self::reset_default_layout(weak_dock_area, window, cx);
});
}
@ -344,7 +344,7 @@ impl StoryTiles {
}
let window_bounds = Bounds::centered(None, window_size, cx);
cx.spawn(|mut cx| async move {
cx.spawn(async move |cx| {
let options = WindowOptions {
window_bounds: Some(WindowBounds::Windowed(window_bounds)),
titlebar: Some(TitlebarOptions {
@ -370,7 +370,7 @@ impl StoryTiles {
})?;
window
.update(&mut cx, |_, window, _| {
.update(cx, |_, window, _| {
window.activate_window();
window.set_window_title("Story Tiles");
})
@ -387,9 +387,9 @@ pub fn open_new(
) -> Task<()> {
let task: Task<std::result::Result<WindowHandle<Root>, anyhow::Error>> =
StoryTiles::new_local(cx);
cx.spawn(|mut cx| async move {
cx.spawn(async move |cx| {
if let Some(root) = task.await.ok() {
root.update(&mut cx, |workspace, window, cx| init(workspace, window, cx))
root.update(cx, |workspace, window, cx| init(workspace, window, cx))
.expect("failed to init workspace");
}
})

View file

@ -124,7 +124,7 @@ where
let window_bounds = Bounds::centered(None, window_size, cx);
let title = SharedString::from(title.to_string());
cx.spawn(|mut cx| async move {
cx.spawn(async move |cx| {
let options = WindowOptions {
window_bounds: Some(WindowBounds::Windowed(window_bounds)),
titlebar: Some(TitleBar::title_bar_options()),
@ -149,7 +149,7 @@ where
.expect("failed to open window");
window
.update(&mut cx, |_, window, _| {
.update(cx, |_, window, _| {
window.activate_window();
window.set_window_title(&title);
})

View file

@ -216,11 +216,11 @@ impl ListDelegate for CompanyListDelegate {
}
fn load_more(&mut self, window: &mut Window, cx: &mut Context<List<Self>>) {
cx.spawn_in(window, |view, mut window| async move {
cx.spawn_in(window, async move |view, window| {
// Simulate network request, delay 1s to load data.
Timer::after(Duration::from_secs(1)).await;
_ = view.update_in(&mut window, move |view, window, cx| {
_ = view.update_in(window, move |view, window, cx| {
let query = view.delegate().query.clone();
view.delegate_mut()
.companies
@ -304,8 +304,8 @@ impl ListStory {
];
// Spawn a background to random refresh the list
cx.spawn(move |this, mut cx| async move {
this.update(&mut cx, |this, cx| {
cx.spawn(async move |this, cx| {
this.update(cx, |this, cx| {
this.company_list.update(cx, |picker, _| {
picker
.delegate_mut()

View file

@ -172,10 +172,10 @@ impl StoryWorkspace {
cx: &mut Context<Self>,
) {
let dock_area = dock_area.clone();
self._save_layout_task = Some(cx.spawn_in(window, |story, mut window| async move {
self._save_layout_task = Some(cx.spawn_in(window, async move |story, window| {
Timer::after(Duration::from_secs(10)).await;
_ = story.update_in(&mut window, move |this, _, cx| {
_ = story.update_in(window, move |this, _, cx| {
let dock_area = dock_area.read(cx);
let state = dock_area.dump(cx);
@ -219,9 +219,9 @@ impl StoryWorkspace {
);
let weak_dock_area = dock_area.downgrade();
cx.spawn_in(window, |this, mut window| async move {
cx.spawn_in(window, async move |this, window| {
if answer.await == Ok(0) {
_ = this.update_in(&mut window, |_, window, cx| {
_ = this.update_in(window, |_, window, cx| {
Self::reset_default_layout(weak_dock_area, window, cx);
});
}
@ -378,7 +378,7 @@ impl StoryWorkspace {
let window_bounds = Bounds::centered(None, window_size, cx);
cx.spawn(|mut cx| async move {
cx.spawn(async move |cx| {
let options = WindowOptions {
window_bounds: Some(WindowBounds::Windowed(window_bounds)),
#[cfg(not(target_os = "linux"))]
@ -401,7 +401,7 @@ impl StoryWorkspace {
})?;
window
.update(&mut cx, |_, window, cx| {
.update(cx, |_, window, cx| {
window.activate_window();
window.set_window_title("GPUI App");
cx.on_release(|_, cx| {
@ -476,9 +476,9 @@ pub fn open_new(
) -> Task<()> {
let task: Task<std::result::Result<WindowHandle<Root>, anyhow::Error>> =
StoryWorkspace::new_local(cx);
cx.spawn(|mut cx| async move {
cx.spawn(async move |cx| {
if let Some(root) = task.await.ok() {
root.update(&mut cx, |workspace, window, cx| init(workspace, window, cx))
root.update(cx, |workspace, window, cx| init(workspace, window, cx))
.expect("failed to init workspace");
}
})

View file

@ -47,12 +47,12 @@ impl ListDelegate for ListItemDeletegate {
cx: &mut Context<List<Self>>,
) -> Task<()> {
let query = query.to_string();
cx.spawn(move |this, mut cx| async move {
cx.spawn(async move |this, cx| {
// Simulate a slow search.
let sleep = (0.05..0.1).fake();
Timer::after(Duration::from_secs_f64(sleep)).await;
this.update(&mut cx, |this, cx| {
this.update(cx, |this, cx| {
this.delegate_mut().matches = this
.delegate()
.items

View file

@ -524,7 +524,7 @@ impl TableDelegate for StockTableDelegate {
fn load_more(&mut self, _: &mut Window, cx: &mut Context<Table<Self>>) {
self.loading = true;
cx.spawn(|view, cx| async move {
cx.spawn(async move |view, cx| {
// Simulate network request, delay 1s to load data.
Timer::after(Duration::from_secs(1)).await;
@ -614,11 +614,11 @@ impl TableStory {
.detach();
// Spawn a background to random refresh the list
cx.spawn(move |this, mut cx| async move {
cx.spawn(async move |this, cx| {
loop {
Timer::after(time::Duration::from_millis(33)).await;
this.update(&mut cx, |this, cx| {
this.update(cx, |this, cx| {
if !this.refresh_data {
return;
}

View file

@ -22,7 +22,7 @@ itertools = "0.13.0"
once_cell = "1.19.0"
paste = "1"
regex = "1"
resvg = { version = "0.44.0", default-features = false, features = ["text"] }
resvg = { version = "0.45.0", default-features = false, features = ["text"] }
rust-embed.workspace = true
rust-i18n = "3"
serde = "1.0.203"
@ -30,7 +30,7 @@ serde_json = "1"
smallvec = "1.13.2"
smol = "1"
unicode-segmentation = "1.12.0"
usvg = { version = "0.44.0", default-features = false, features = ["text"] }
usvg = { version = "0.45.0", default-features = false, features = ["text"] }
uuid = "1.10"
wry = { version = "0.48.0", optional = true }
# Markdown Parser

View file

@ -131,7 +131,7 @@ impl Element for Clipboard {
*copied.borrow_mut() = true;
let copied = copied.clone();
cx.spawn(|cx| async move {
cx.spawn(async move |cx| {
cx.background_executor().timer(Duration::from_secs(2)).await;
*copied.borrow_mut() = false;

View file

@ -879,8 +879,8 @@ impl DockArea {
window,
move |_, _, event, window, cx| match event {
PanelEvent::LayoutChanged => {
cx.spawn_in(window, |view, mut window| async move {
_ = view.update_in(&mut window, |view, window, cx| {
cx.spawn_in(window, async move |view, window| {
_ = view.update_in(window, |view, window, cx| {
view.update_toggle_button_tab_panels(window, cx)
});
})
@ -917,8 +917,8 @@ impl DockArea {
move |_, panel, event, window, cx| match event {
PanelEvent::ZoomIn => {
let panel = panel.clone();
cx.spawn_in(window, |view, mut window| async move {
_ = view.update_in(&mut window, |view, window, cx| {
cx.spawn_in(window, async move |view, window| {
_ = view.update_in(window, |view, window, cx| {
view.set_zoomed_in(panel, window, cx);
cx.notify();
});
@ -926,15 +926,15 @@ impl DockArea {
.detach();
}
PanelEvent::ZoomOut => cx
.spawn_in(window, |view, mut window| async move {
_ = view.update_in(&mut window, |view, window, cx| {
.spawn_in(window, async move |view, window| {
_ = view.update_in(window, |view, window, cx| {
view.set_zoomed_out(window, cx);
});
})
.detach(),
PanelEvent::LayoutChanged => {
cx.spawn_in(window, |view, mut window| async move {
_ = view.update_in(&mut window, |view, window, cx| {
cx.spawn_in(window, async move |view, window| {
_ = view.update_in(window, |view, window, cx| {
view.update_toggle_button_tab_panels(window, cx)
});
})

View file

@ -201,7 +201,7 @@ impl TabPanel {
self.focus_active_panel(window, cx);
// Sync the active state to all panels
cx.spawn_in(window, |view, mut cx| async move {
cx.spawn_in(window, async move |view, cx| {
_ = cx.update(|window, cx| {
_ = view.update(cx, |view, cx| {
if let Some(last_active) = view.panels.get(last_active_ix) {
@ -268,7 +268,7 @@ impl TabPanel {
window: &mut Window,
cx: &mut Context<Self>,
) {
cx.spawn_in(window, |view, mut cx| async move {
cx.spawn_in(window, async move |view, cx| {
cx.update(|window, cx| {
view.update(cx, |view, cx| {
view.will_split_placement = Some(placement);
@ -1021,7 +1021,7 @@ impl TabPanel {
});
}
cx.spawn_in(window, |_, mut cx| async move {
cx.spawn_in(window, async move |_, cx| {
cx.update(|window, cx| {
tab_panel.update(cx, |view, cx| view.remove_self_if_empty(window, cx))
})
@ -1055,9 +1055,9 @@ impl TabPanel {
}
self.zoomed = !self.zoomed;
cx.spawn_in(window, |view, mut cx| {
cx.spawn_in(window, {
let zoomed = self.zoomed;
async move {
async move |view, cx| {
_ = cx.update(|window, cx| {
_ = view.update(cx, |view, cx| {
view.set_zoomed(zoomed, window, cx);

View file

@ -51,10 +51,10 @@ impl BlinkCursor {
// Schedule the next blink
let epoch = self.next_epoch();
cx.spawn(|this, mut cx| async move {
cx.spawn(async move |this, cx| {
Timer::after(INTERVAL).await;
if let Some(this) = this.upgrade() {
this.update(&mut cx, |this, cx| this.blink(epoch, cx)).ok();
this.update(cx, |this, cx| this.blink(epoch, cx)).ok();
}
})
.detach();
@ -72,11 +72,11 @@ impl BlinkCursor {
// delay 500ms to start the blinking
let epoch = self.next_epoch();
cx.spawn(|this, mut cx| async move {
cx.spawn(async move |this, cx| {
Timer::after(PAUSE_DELAY).await;
if let Some(this) = this.upgrade() {
this.update(&mut cx, |this, cx| {
this.update(cx, |this, cx| {
this.paused = false;
this.blink(epoch, cx);
})

View file

@ -331,10 +331,10 @@ where
self.set_querying(true, window, cx);
let search = self.delegate.perform_search(&text, window, cx);
self._search_task = cx.spawn_in(window, |this, mut window| async move {
self._search_task = cx.spawn_in(window, async move |this, window| {
search.await;
_ = this.update_in(&mut window, |this, _, _| {
_ = this.update_in(window, |this, _, _| {
this.vertical_scroll_handle
.scroll_to_item(0, ScrollStrategy::Top);
this.last_query = Some(text);
@ -342,7 +342,7 @@ where
// Always wait 100ms to avoid flicker
Timer::after(Duration::from_millis(100)).await;
_ = this.update_in(&mut window, |this, window, cx| {
_ = this.update_in(window, |this, window, cx| {
this.set_querying(false, window, cx);
});
});
@ -375,8 +375,8 @@ where
return;
}
self._load_more_task = cx.spawn_in(window, |view, mut cx| async move {
_ = view.update_in(&mut cx, |view, window, cx| {
self._load_more_task = cx.spawn_in(window, async move |view, cx| {
_ = view.update_in(cx, |view, window, cx| {
view.delegate.load_more(window, cx);
});
});

View file

@ -186,7 +186,7 @@ impl Notification {
cx.notify();
// Dismiss the notification after 0.15s to show the animation.
cx.spawn(|view, cx| async move {
cx.spawn(async move |view, cx| {
Timer::after(Duration::from_secs_f32(0.15)).await;
cx.update(|cx| {
if let Some(view) = view.upgrade() {
@ -330,10 +330,10 @@ impl NotificationList {
self.notifications.push_back(notification.clone());
if autohide {
// Sleep for 5 seconds to autohide the notification
cx.spawn_in(window, |_, mut cx| async move {
cx.spawn_in(window, async move |_, cx| {
Timer::after(Duration::from_secs(5)).await;
if let Err(err) = notification.update_in(&mut cx, |note, window, cx| {
if let Err(err) = notification.update_in(cx, |note, window, cx| {
note.dismiss(&ClickEvent::default(), window, cx)
}) {
println!("failed to auto hide notification: {:?}", err);

View file

@ -169,7 +169,7 @@ impl Element for Switch {
.map_or(false, |prev| prev != checked)
{
let dur = Duration::from_secs_f64(0.15);
cx.spawn(|cx| async move {
cx.spawn(async move |cx| {
cx.background_executor().timer(dur).await;
*prev_checked.borrow_mut() = Some(checked);

View file

@ -759,8 +759,8 @@ where
return;
}
self._load_more_task = cx.spawn_in(window, |view, mut window| async move {
_ = view.update_in(&mut window, |view, window, cx| {
self._load_more_task = cx.spawn_in(window, async move |view, window| {
_ = view.update_in(window, |view, window, cx| {
view.delegate.load_more(window, cx);
});
});