Change Cow<[ComponentId]> to Box<[ComponentId]> (#4185)
				
					
				
			`Cow::Borrowed` was never used
This commit is contained in:
		
							parent
							
								
									7ce3ae43e3
								
							
						
					
					
						commit
						e7a9420443
					
				@ -8,7 +8,6 @@ use crate::{
 | 
				
			|||||||
    storage::{Column, SparseArray, SparseSet, SparseSetIndex, TableId},
 | 
					    storage::{Column, SparseArray, SparseSet, SparseSetIndex, TableId},
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
use std::{
 | 
					use std::{
 | 
				
			||||||
    borrow::Cow,
 | 
					 | 
				
			||||||
    collections::HashMap,
 | 
					    collections::HashMap,
 | 
				
			||||||
    hash::Hash,
 | 
					    hash::Hash,
 | 
				
			||||||
    ops::{Index, IndexMut},
 | 
					    ops::{Index, IndexMut},
 | 
				
			||||||
@ -121,8 +120,8 @@ pub struct Archetype {
 | 
				
			|||||||
    entities: Vec<Entity>,
 | 
					    entities: Vec<Entity>,
 | 
				
			||||||
    edges: Edges,
 | 
					    edges: Edges,
 | 
				
			||||||
    table_info: TableInfo,
 | 
					    table_info: TableInfo,
 | 
				
			||||||
    table_components: Cow<'static, [ComponentId]>,
 | 
					    table_components: Box<[ComponentId]>,
 | 
				
			||||||
    sparse_set_components: Cow<'static, [ComponentId]>,
 | 
					    sparse_set_components: Box<[ComponentId]>,
 | 
				
			||||||
    pub(crate) unique_components: SparseSet<ComponentId, Column>,
 | 
					    pub(crate) unique_components: SparseSet<ComponentId, Column>,
 | 
				
			||||||
    pub(crate) components: SparseSet<ComponentId, ArchetypeComponentInfo>,
 | 
					    pub(crate) components: SparseSet<ComponentId, ArchetypeComponentInfo>,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -131,8 +130,8 @@ impl Archetype {
 | 
				
			|||||||
    pub fn new(
 | 
					    pub fn new(
 | 
				
			||||||
        id: ArchetypeId,
 | 
					        id: ArchetypeId,
 | 
				
			||||||
        table_id: TableId,
 | 
					        table_id: TableId,
 | 
				
			||||||
        table_components: Cow<'static, [ComponentId]>,
 | 
					        table_components: Box<[ComponentId]>,
 | 
				
			||||||
        sparse_set_components: Cow<'static, [ComponentId]>,
 | 
					        sparse_set_components: Box<[ComponentId]>,
 | 
				
			||||||
        table_archetype_components: Vec<ArchetypeComponentId>,
 | 
					        table_archetype_components: Vec<ArchetypeComponentId>,
 | 
				
			||||||
        sparse_set_archetype_components: Vec<ArchetypeComponentId>,
 | 
					        sparse_set_archetype_components: Vec<ArchetypeComponentId>,
 | 
				
			||||||
    ) -> Self {
 | 
					    ) -> Self {
 | 
				
			||||||
@ -331,8 +330,8 @@ impl ArchetypeGeneration {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#[derive(Hash, PartialEq, Eq)]
 | 
					#[derive(Hash, PartialEq, Eq)]
 | 
				
			||||||
pub struct ArchetypeIdentity {
 | 
					pub struct ArchetypeIdentity {
 | 
				
			||||||
    table_components: Cow<'static, [ComponentId]>,
 | 
					    table_components: Box<[ComponentId]>,
 | 
				
			||||||
    sparse_set_components: Cow<'static, [ComponentId]>,
 | 
					    sparse_set_components: Box<[ComponentId]>,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
 | 
					#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
 | 
				
			||||||
@ -381,8 +380,8 @@ impl Default for Archetypes {
 | 
				
			|||||||
        archetypes.archetypes.push(Archetype::new(
 | 
					        archetypes.archetypes.push(Archetype::new(
 | 
				
			||||||
            ArchetypeId::RESOURCE,
 | 
					            ArchetypeId::RESOURCE,
 | 
				
			||||||
            TableId::empty(),
 | 
					            TableId::empty(),
 | 
				
			||||||
            Cow::Owned(Vec::new()),
 | 
					            Box::new([]),
 | 
				
			||||||
            Cow::Owned(Vec::new()),
 | 
					            Box::new([]),
 | 
				
			||||||
            Vec::new(),
 | 
					            Vec::new(),
 | 
				
			||||||
            Vec::new(),
 | 
					            Vec::new(),
 | 
				
			||||||
        ));
 | 
					        ));
 | 
				
			||||||
@ -477,8 +476,8 @@ impl Archetypes {
 | 
				
			|||||||
        table_components: Vec<ComponentId>,
 | 
					        table_components: Vec<ComponentId>,
 | 
				
			||||||
        sparse_set_components: Vec<ComponentId>,
 | 
					        sparse_set_components: Vec<ComponentId>,
 | 
				
			||||||
    ) -> ArchetypeId {
 | 
					    ) -> ArchetypeId {
 | 
				
			||||||
        let table_components = Cow::from(table_components);
 | 
					        let table_components = table_components.into_boxed_slice();
 | 
				
			||||||
        let sparse_set_components = Cow::from(sparse_set_components);
 | 
					        let sparse_set_components = sparse_set_components.into_boxed_slice();
 | 
				
			||||||
        let archetype_identity = ArchetypeIdentity {
 | 
					        let archetype_identity = ArchetypeIdentity {
 | 
				
			||||||
            sparse_set_components: sparse_set_components.clone(),
 | 
					            sparse_set_components: sparse_set_components.clone(),
 | 
				
			||||||
            table_components: table_components.clone(),
 | 
					            table_components: table_components.clone(),
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user