From 6f9dd8070f72588f5621f23ad67003a986526ea7 Mon Sep 17 00:00:00 2001 From: Zac Harrold Date: Thu, 27 Feb 2025 09:03:01 +1100 Subject: [PATCH] Polish `bevy_reflect` `no_std` support --- crates/bevy_reflect/Cargo.toml | 7 ++++--- crates/bevy_reflect/src/func/registry.rs | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/crates/bevy_reflect/Cargo.toml b/crates/bevy_reflect/Cargo.toml index ada4237cc95d5..21b15e6f08aa2 100644 --- a/crates/bevy_reflect/Cargo.toml +++ b/crates/bevy_reflect/Cargo.toml @@ -29,7 +29,7 @@ bevy = ["smallvec", "smol_str"] debug = ["debug_stack"] ## When enabled, keeps track of the current serialization/deserialization context for better error messages -debug_stack = [] +debug_stack = ["std"] # Integrations @@ -46,7 +46,7 @@ smallvec = ["dep:smallvec"] uuid = ["dep:uuid"] ## Adds reflection support to `wgpu-types` types. -wgpu-types = ["dep:wgpu-types", "std"] +wgpu-types = ["dep:wgpu-types"] # Platform Compatibility @@ -62,6 +62,7 @@ std = [ "smol_str?/std", "uuid?/std", "bevy_platform_support/std", + "wgpu-types?/std", ] ## `critical-section` provides the building blocks for synchronization primitives @@ -109,7 +110,7 @@ uuid = { version = "1.13.1", default-features = false, optional = true, features "serde", ] } variadics_please = "1.1" -wgpu-types = { version = "24", features = ["serde"], optional = true } +wgpu-types = { version = "24", features = ["serde"], optional = true, default-features = false } [target.'cfg(target_arch = "wasm32")'.dependencies] uuid = { version = "1.13.1", default-features = false, features = ["js"] } diff --git a/crates/bevy_reflect/src/func/registry.rs b/crates/bevy_reflect/src/func/registry.rs index 450a3722d4da8..d9a570dbe19a2 100644 --- a/crates/bevy_reflect/src/func/registry.rs +++ b/crates/bevy_reflect/src/func/registry.rs @@ -1,8 +1,9 @@ use alloc::borrow::Cow; -use bevy_platform_support::collections::HashMap; -use bevy_platform_support::sync::Arc; +use bevy_platform_support::{ + collections::HashMap, + sync::{Arc, PoisonError, RwLock, RwLockReadGuard, RwLockWriteGuard}, +}; use core::fmt::Debug; -use std::sync::{PoisonError, RwLock, RwLockReadGuard, RwLockWriteGuard}; use crate::func::{ ArgList, DynamicFunction, FunctionRegistrationError, FunctionResult, IntoFunction,