From 1232ac361133d0aa460fc08080142487d6dc063f Mon Sep 17 00:00:00 2001 From: mStar Date: Mon, 17 Mar 2025 08:40:29 +0100 Subject: [PATCH] Update Godot api level, add gdext_coroutine --- learning-rust4.4/GdExt.gdextension | 2 +- rust/Cargo.lock | 10 ++++++++++ rust/Cargo.toml | 1 + rust/src/lib.rs | 6 ++++++ rust/src/portals/screencast.rs | 2 +- 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/learning-rust4.4/GdExt.gdextension b/learning-rust4.4/GdExt.gdextension index 93ed6cb..9f41059 100644 --- a/learning-rust4.4/GdExt.gdextension +++ b/learning-rust4.4/GdExt.gdextension @@ -1,6 +1,6 @@ [configuration] entry_symbol = "gdext_rust_init" -compatibility_minimum = 4.1 +compatibility_minimum = 4.2 reloadable = true [libraries] diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 8a4d1c2..30bcf7c 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -434,11 +434,21 @@ name = "gd-wireportal" version = "0.1.0" dependencies = [ "ashpd", + "gdext_coroutines", "godot", "godot_tokio", "pipewire", ] +[[package]] +name = "gdext_coroutines" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92b254068dbdb5a5a9d702039f5b741ac9a454617c28f69c5cc6c31792c7d11d" +dependencies = [ + "godot", +] + [[package]] name = "gdextension-api" version = "0.2.2" diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 2b5bd34..17c2e80 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -5,6 +5,7 @@ edition = "2021" [dependencies] ashpd = "0.11.0" +gdext_coroutines = "0.7.1" godot = "0.2.4" godot_tokio = "0.3.0" pipewire = "0.8.0" diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 29c1c76..18ee31d 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -1,3 +1,9 @@ +#![feature(coroutines)] +#![feature(coroutine_trait)] +#![feature(stmt_expr_attributes)] +#![feature(unboxed_closures)] +#![cfg_attr(feature = "async", feature(async_fn_traits))] + use godot::{classes::Engine, prelude::*}; use godot_tokio::AsyncRuntime; diff --git a/rust/src/portals/screencast.rs b/rust/src/portals/screencast.rs index 89de71b..9d57859 100644 --- a/rust/src/portals/screencast.rs +++ b/rust/src/portals/screencast.rs @@ -4,7 +4,7 @@ use ashpd::desktop::{ }; use godot::prelude::*; use godot_tokio::AsyncRuntime; -use std::thread; +//use std::thread; #[derive(GodotClass)] #[class(base=RefCounted)]