Skip to content

Commit ff85a63

Browse files
committed
Fix docs
1 parent d1520f6 commit ff85a63

File tree

3 files changed

+27
-17
lines changed

3 files changed

+27
-17
lines changed

crates/bevy_ecs/src/archetype.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ impl Archetype {
417417
},
418418
);
419419
// NOTE: the `table_components` are sorted AND they were inserted in the `Table` in the same
420-
// sorted order, so the index of the `Column` in the `Table` is the same as the index of the
420+
// sorted order, so the index of the `ThinColumn` in the `Table` is the same as the index of the
421421
// component in the `table_components` vector
422422
component_index
423423
.entry(component_id)

crates/bevy_ecs/src/storage/blob_array.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ use bevy_ptr::{OwningPtr, Ptr, PtrMut};
33
use bevy_utils::OnDrop;
44
use core::{alloc::Layout, cell::UnsafeCell, num::NonZeroUsize, ptr::NonNull};
55

6-
/// A flat, type-erased data storage type similar to a [`BlobVec`](super::blob_vec::BlobVec), but with the length and capacity cut out
7-
/// for performance reasons. This type is reliant on its owning type to store the capacity and length information.
6+
/// A flat, type-erased data storage type.
87
///
98
/// Used to densely store homogeneous ECS data. A blob is usually just an arbitrary block of contiguous memory without any identity, and
10-
/// could be used to represent any arbitrary data (i.e. string, arrays, etc). This type only stores meta-data about the Blob that it stores,
11-
/// and a pointer to the location of the start of the array, similar to a C array.
9+
/// could be used to represent any arbitrary data (i.e. string, arrays, etc). This type only stores meta-data about the blob that it stores,
10+
/// and a pointer to the location of the start of the array, similar to a C-style `void*` array.
11+
///
12+
/// for performance reasons. This type is reliant on its owning type to store the capacity and length information.
1213
#[derive(Debug)]
1314
pub(super) struct BlobArray {
1415
item_layout: Layout,

crates/bevy_ecs/src/storage/table/column.rs

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,22 @@ use crate::{
55
};
66
use core::panic::Location;
77

8-
/// Very similar to a normal [`Column`], but with the capacities and lengths cut out for performance reasons.
8+
/// A type-erased contiguous container for data of a homogeneous type.
99
///
10-
/// This type is used by [`Table`], because all of the capacities and lengths of the [`Table`]'s columns must match.
10+
/// Conceptually, a `ThinColumn` is very similar to a type-erased `Box<[T]>`.
11+
/// It also stores the change detection ticks for its components, kept in two separate
12+
/// contiguous buffers internally. An element shares its data across these buffers by using the
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).
1114
///
12-
/// Like many other low-level storage types, [`ThinColumn`] has a limited and highly unsafe
15+
/// Like many other low-level storage types, `ThinColumn` has a limited and highly unsafe
1316
/// interface. It's highly advised to use higher level types and their safe abstractions
14-
/// instead of working directly with [`ThinColumn`].
17+
/// instead of working directly with `ThinColumn`.
18+
///
19+
/// For performance reasons, `ThinColumn` does not does not store it's capacity and length.
20+
/// This type is used by [`Table`] and [`ComponentSparseSet`], because all of the capacities
21+
/// and lengths of the owning storaage.
22+
///
23+
/// [`ComponentSparseSet`]: crate::storage::ComponentSparseSet
1524
#[derive(Debug)]
1625
pub struct ThinColumn {
1726
pub(super) data: BlobArray,
@@ -351,7 +360,7 @@ impl ThinColumn {
351360
.map(|changed_by| changed_by.as_slice(len))
352361
}
353362

354-
/// Fetches a read-only reference to the data at `row`. Unlike [`Column::get`] this does not
363+
/// Fetches a read-only reference to the data at `row`. This does not
355364
/// do any bounds checking.
356365
///
357366
/// # Safety
@@ -364,7 +373,7 @@ impl ThinColumn {
364373

365374
/// Fetches the calling location that last changed the value at `row`.
366375
///
367-
/// Unlike [`Column::get_changed_by`] this function does not do any bounds checking.
376+
/// This function does not do any bounds checking.
368377
///
369378
/// # Safety
370379
/// `row` must be within the range `[0, self.len())`.
@@ -378,8 +387,8 @@ impl ThinColumn {
378387
.map(|changed_by| changed_by.get_unchecked(row.index()))
379388
}
380389

381-
/// Fetches the "added" change detection tick for the value at `row`. Unlike [`Column::get_added_tick`]
382-
/// this function does not do any bounds checking.
390+
/// Fetches the "added" change detection tick for the value at `row`.
391+
/// This function does not do any bounds checking.
383392
///
384393
/// # Safety
385394
/// `row` must be within the range `[0, self.len())`.
@@ -388,8 +397,8 @@ impl ThinColumn {
388397
self.added_ticks.get_unchecked(row.index())
389398
}
390399

391-
/// Fetches the "changed" change detection tick for the value at `row`. Unlike [`Column::get_changed_tick`]
392-
/// this function does not do any bounds checking.
400+
/// Fetches the "changed" change detection tick for the value at `row`
401+
/// This function does not do any bounds checking.
393402
///
394403
/// # Safety
395404
/// `row` must be within the range `[0, self.len())`.
@@ -398,8 +407,8 @@ impl ThinColumn {
398407
self.changed_ticks.get_unchecked(row.index())
399408
}
400409

401-
/// Fetches the change detection ticks for the value at `row`. Unlike [`Column::get_ticks`]
402-
/// this function does not do any bounds checking.
410+
/// Fetches the change detection ticks for the value at `row`.
411+
/// This function does not do any bounds checking.
403412
///
404413
/// # Safety
405414
/// `row` must be within the range `[0, self.len())`.

0 commit comments

Comments
 (0)