@@ -7,30 +7,30 @@ use core::{mem::needs_drop, panic::Location};
7
7
8
8
/// A type-erased contiguous container for data of a homogeneous type.
9
9
///
10
- /// Conceptually, a `ThinColumn ` is very similar to a type-erased `Box<[T]>`.
10
+ /// Conceptually, a `Column ` is very similar to a type-erased `Box<[T]>`.
11
11
/// It also stores the change detection ticks for its components, kept in two separate
12
12
/// contiguous buffers internally. An element shares its data across these buffers by using the
13
13
/// same index (i.e. the entity at row 3 has it's data at index 3 and its change detection ticks at index 3).
14
14
///
15
- /// Like many other low-level storage types, `ThinColumn ` has a limited and highly unsafe
15
+ /// Like many other low-level storage types, `Column ` has a limited and highly unsafe
16
16
/// interface. It's highly advised to use higher level types and their safe abstractions
17
- /// instead of working directly with `ThinColumn `.
17
+ /// instead of working directly with `Column `.
18
18
///
19
- /// For performance reasons, `ThinColumn ` does not does not store it's capacity and length.
19
+ /// For performance reasons, `Column ` does not does not store it's capacity and length.
20
20
/// This type is used by [`Table`] and [`ComponentSparseSet`], where the corresponding capacity
21
21
/// and length can be found.
22
22
///
23
23
/// [`ComponentSparseSet`]: crate::storage::ComponentSparseSet
24
24
#[ derive( Debug ) ]
25
- pub struct ThinColumn {
25
+ pub struct Column {
26
26
pub ( super ) data : BlobArray ,
27
27
pub ( super ) added_ticks : ThinArrayPtr < UnsafeCell < Tick > > ,
28
28
pub ( super ) changed_ticks : ThinArrayPtr < UnsafeCell < Tick > > ,
29
29
pub ( super ) changed_by : MaybeLocation < ThinArrayPtr < UnsafeCell < & ' static Location < ' static > > > > ,
30
30
}
31
31
32
- impl ThinColumn {
33
- /// Create a new [`ThinColumn `] with the given `capacity`.
32
+ impl Column {
33
+ /// Create a new [`Column `] with the given `capacity`.
34
34
pub fn with_capacity ( component_info : & ComponentInfo , capacity : usize ) -> Self {
35
35
Self {
36
36
// SAFETY: The components stored in this columns will match the information in `component_info`
@@ -137,7 +137,7 @@ impl ThinColumn {
137
137
data
138
138
}
139
139
140
- /// Call [`realloc`](std::alloc::realloc) to expand / shrink the memory allocation for this [`ThinColumn `]
140
+ /// Call [`realloc`](std::alloc::realloc) to expand / shrink the memory allocation for this [`Column `]
141
141
///
142
142
/// # Panics
143
143
/// - Panics if the any of the new capacity overflows `isize::MAX` bytes.
@@ -159,7 +159,7 @@ impl ThinColumn {
159
159
. map ( |changed_by| changed_by. realloc ( current_capacity, new_capacity) ) ;
160
160
}
161
161
162
- /// Call [`alloc`](std::alloc::alloc) to allocate memory for this [`ThinColumn `]
162
+ /// Call [`alloc`](std::alloc::alloc) to allocate memory for this [`Column `]
163
163
/// The caller should make sure their saved `capacity` value is updated to `new_capacity` after this operation.
164
164
///
165
165
/// # Panics
@@ -233,7 +233,7 @@ impl ThinColumn {
233
233
#[ inline]
234
234
pub ( crate ) unsafe fn initialize_from_unchecked (
235
235
& mut self ,
236
- other : & mut ThinColumn ,
236
+ other : & mut Column ,
237
237
other_last_element_index : usize ,
238
238
src_row : TableRow ,
239
239
dst_row : TableRow ,
@@ -302,7 +302,7 @@ impl ThinColumn {
302
302
}
303
303
304
304
/// Because this method needs parameters, it can't be the implementation of the `Drop` trait.
305
- /// The owner of this [`ThinColumn `] must call this method with the correct information.
305
+ /// The owner of this [`Column `] must call this method with the correct information.
306
306
///
307
307
/// # Safety
308
308
/// - `len` is indeed the length of the column
@@ -330,32 +330,32 @@ impl ThinColumn {
330
330
self . data . drop_last_element ( last_element_index) ;
331
331
}
332
332
333
- /// Get a slice to the data stored in this [`ThinColumn `].
333
+ /// Get a slice to the data stored in this [`Column `].
334
334
///
335
335
/// # Safety
336
- /// - `T` must match the type of data that's stored in this [`ThinColumn `]
336
+ /// - `T` must match the type of data that's stored in this [`Column `]
337
337
/// - `len` must match the actual length of this column (number of elements stored)
338
338
pub unsafe fn get_data_slice < T > ( & self , len : usize ) -> & [ UnsafeCell < T > ] {
339
339
self . data . get_sub_slice ( len)
340
340
}
341
341
342
- /// Get a slice to the added [`ticks`](Tick) in this [`ThinColumn `].
342
+ /// Get a slice to the added [`ticks`](Tick) in this [`Column `].
343
343
///
344
344
/// # Safety
345
345
/// - `len` must match the actual length of this column (number of elements stored)
346
346
pub unsafe fn get_added_ticks_slice ( & self , len : usize ) -> & [ UnsafeCell < Tick > ] {
347
347
self . added_ticks . as_slice ( len)
348
348
}
349
349
350
- /// Get a slice to the changed [`ticks`](Tick) in this [`ThinColumn `].
350
+ /// Get a slice to the changed [`ticks`](Tick) in this [`Column `].
351
351
///
352
352
/// # Safety
353
353
/// - `len` must match the actual length of this column (number of elements stored)
354
354
pub unsafe fn get_changed_ticks_slice ( & self , len : usize ) -> & [ UnsafeCell < Tick > ] {
355
355
self . changed_ticks . as_slice ( len)
356
356
}
357
357
358
- /// Get a slice to the calling locations that last changed each value in this [`ThinColumn `]
358
+ /// Get a slice to the calling locations that last changed each value in this [`Column `]
359
359
///
360
360
/// # Safety
361
361
/// - `len` must match the actual length of this column (number of elements stored)
0 commit comments