Bulk gcore cleanup, replace core and alloc with std (#2735)

* gcore: replace `core` and `alloc` paths with `std`

* node-graph: remove unnecessary path prefix

* gcore: remove most `#[cfg(target_arch = "spirv")]`, keep some potentially useful ones

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Firestar99
2025-06-21 23:08:33 +00:00
committed by GitHub
co-authored by Keavon Chambers
parent 301368a0df
commit 990d5b37cf
46 changed files with 287 additions and 313 deletions
+18 -18
View File
@@ -108,10 +108,10 @@ pub static NODE_REGISTRY: NodeRegistry = LazyLock::new(|| Mutex::new(HashMap::ne
pub static NODE_METADATA: LazyLock<Mutex<HashMap<String, NodeMetadata>>> = LazyLock::new(|| Mutex::new(HashMap::new()));
#[cfg(not(target_arch = "wasm32"))]
pub type DynFuture<'n, T> = Pin<Box<dyn core::future::Future<Output = T> + 'n + Send>>;
pub type DynFuture<'n, T> = Pin<Box<dyn Future<Output = T> + 'n + Send>>;
#[cfg(target_arch = "wasm32")]
pub type DynFuture<'n, T> = Pin<Box<dyn core::future::Future<Output = T> + 'n>>;
pub type LocalFuture<'n, T> = Pin<Box<dyn core::future::Future<Output = T> + 'n>>;
pub type DynFuture<'n, T> = Pin<Box<dyn std::future::Future<Output = T> + 'n>>;
pub type LocalFuture<'n, T> = Pin<Box<dyn Future<Output = T> + 'n>>;
#[cfg(not(target_arch = "wasm32"))]
pub type Any<'n> = Box<dyn DynAny<'n> + 'n + Send>;
#[cfg(target_arch = "wasm32")]
@@ -169,8 +169,8 @@ impl Drop for NodeContainer {
}
}
impl core::fmt::Debug for NodeContainer {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> std::fmt::Result {
impl std::fmt::Debug for NodeContainer {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("NodeContainer").finish()
}
}
@@ -184,7 +184,7 @@ impl NodeContainer {
#[cfg(feature = "dealloc_nodes")]
unsafe fn dealloc_unchecked(&mut self) {
unsafe {
std::mem::drop(Box::from_raw(self.node as *mut TypeErasedNode));
drop(Box::from_raw(self.node as *mut TypeErasedNode));
}
}
}
@@ -219,7 +219,7 @@ where
self.node.reset();
}
fn serialize(&self) -> Option<std::sync::Arc<dyn core::any::Any + Send + Sync>> {
fn serialize(&self) -> Option<std::sync::Arc<dyn std::any::Any + Send + Sync>> {
self.node.serialize()
}
}
@@ -227,8 +227,8 @@ impl<I, O> DowncastBothNode<I, O> {
pub const fn new(node: SharedNodeContainer) -> Self {
Self {
node,
_i: core::marker::PhantomData,
_o: core::marker::PhantomData,
_i: PhantomData,
_o: PhantomData,
}
}
}
@@ -252,7 +252,7 @@ where
}
#[inline(always)]
fn serialize(&self) -> Option<std::sync::Arc<dyn core::any::Any + Send + Sync>> {
fn serialize(&self) -> Option<std::sync::Arc<dyn std::any::Any + Send + Sync>> {
self.node.serialize()
}
}
@@ -271,14 +271,14 @@ pub struct DynAnyNode<I, O, Node> {
impl<'input, I, O, N> Node<'input, Any<'input>> for DynAnyNode<I, O, N>
where
I: 'input + dyn_any::StaticType + WasmNotSend,
O: 'input + dyn_any::StaticType + WasmNotSend,
I: 'input + StaticType + WasmNotSend,
O: 'input + StaticType + WasmNotSend,
N: 'input + Node<'input, I, Output = DynFuture<'input, O>>,
{
type Output = FutureAny<'input>;
#[inline]
fn eval(&'input self, input: Any<'input>) -> Self::Output {
let node_name = core::any::type_name::<N>();
let node_name = std::any::type_name::<N>();
let output = |input| {
let result = self.node.eval(input);
async move { Box::new(result.await) as Any<'input> }
@@ -293,21 +293,21 @@ where
self.node.reset();
}
fn serialize(&self) -> Option<std::sync::Arc<dyn core::any::Any + Send + Sync>> {
fn serialize(&self) -> Option<std::sync::Arc<dyn std::any::Any + Send + Sync>> {
self.node.serialize()
}
}
impl<'input, I, O, N> DynAnyNode<I, O, N>
where
I: 'input + dyn_any::StaticType,
O: 'input + dyn_any::StaticType,
I: 'input + StaticType,
O: 'input + StaticType,
N: 'input + Node<'input, I, Output = DynFuture<'input, O>>,
{
pub const fn new(node: N) -> Self {
Self {
node,
_i: core::marker::PhantomData,
_o: core::marker::PhantomData,
_i: PhantomData,
_o: PhantomData,
}
}
}