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-22 01:08:33 +02:00 committed by GitHub
parent 301368a0df
commit 990d5b37cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
46 changed files with 287 additions and 313 deletions

View file

@ -147,7 +147,7 @@ pub struct DocumentNode {
#[cfg_attr(feature = "serde", serde(default = "return_true"))]
pub visible: bool,
/// When two different proto nodes hash to the same value (e.g. two value nodes each containing `2_u32` or two multiply nodes that have the same node IDs as input), the duplicates are removed.
/// See [`crate::proto::ProtoNetwork::generate_stable_node_ids`] for details.
/// See [`ProtoNetwork::generate_stable_node_ids`] for details.
/// However sometimes this is not desirable, for example in the case of a [`graphene_core::memo::MonitorNode`] that needs to be accessed outside of the graph.
#[cfg_attr(feature = "serde", serde(default))]
pub skip_deduplication: bool,
@ -602,7 +602,7 @@ pub struct OldDocumentNode {
/// Metadata about the node including its position in the graph UI. Ensure the click target in the encapsulating network is updated when the node moves by using network.update_click_target(node_id).
pub metadata: OldDocumentNodeMetadata,
/// When two different proto nodes hash to the same value (e.g. two value nodes each containing `2_u32` or two multiply nodes that have the same node IDs as input), the duplicates are removed.
/// See [`crate::proto::ProtoNetwork::generate_stable_node_ids`] for details.
/// See [`ProtoNetwork::generate_stable_node_ids`] for details.
/// However sometimes this is not desirable, for example in the case of a [`graphene_core::memo::MonitorNode`] that needs to be accessed outside of the graph.
#[cfg_attr(feature = "serde", serde(default))]
pub skip_deduplication: bool,
@ -710,8 +710,8 @@ pub struct NodeNetwork {
pub scope_injections: FxHashMap<String, (NodeId, Type)>,
}
impl std::hash::Hash for NodeNetwork {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
impl Hash for NodeNetwork {
fn hash<H: Hasher>(&self, state: &mut H) {
self.exports.hash(state);
let mut nodes: Vec<_> = self.nodes.iter().collect();
nodes.sort_by_key(|(id, _)| *id);

View file

@ -373,7 +373,7 @@ impl ProtoNetwork {
(inwards_edges, id_map)
}
/// Inserts a [`graphene_core::structural::ComposeNode`] for each node that has a [`ProtoNodeInput::Node`]. The compose node evaluates the first node, and then sends the result into the second node.
/// Inserts a [`structural::ComposeNode`] for each node that has a [`ProtoNodeInput::Node`]. The compose node evaluates the first node, and then sends the result into the second node.
pub fn resolve_inputs(&mut self) -> Result<(), String> {
// Perform topological sort once
self.reorder_ids()?;
@ -542,7 +542,7 @@ pub enum GraphErrorType {
InvalidImplementations { inputs: String, error_inputs: Vec<Vec<(usize, (Type, Type))>> },
MultipleImplementations { inputs: String, valid: Vec<NodeIOTypes> },
}
impl core::fmt::Debug for GraphErrorType {
impl Debug for GraphErrorType {
// TODO: format with the document graph context so the input index is the same as in the graph UI.
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
@ -603,7 +603,7 @@ impl GraphError {
}
}
}
impl core::fmt::Debug for GraphError {
impl Debug for GraphError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("NodeGraphError")
.field("path", &self.node_path.iter().map(|id| id.0).collect::<Vec<_>>())