Skip to content

Commit e087013

Browse files
committed
Updated docs for List Trait in bevy_reflect (#6872)
# Objective Fixes #6866. ## Solution Docs now should describe what the _front_, _first_, _back_, and _last_ elements are for an implementor of the `bevy::reflect::list::List` Trait. Further, the docs should describe how `bevy::reflect::list::List::push` and `bevy::reflect::list::List::pop` should act on these elements. Co-authored-by: Linus Käll <[email protected]>
1 parent 10898d1 commit e087013

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

crates/bevy_reflect/src/list.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@ use crate::{
1111
///
1212
/// This is a sub-trait of [`Array`] as it implements a [`push`](List::push) function, allowing
1313
/// it's internal size to grow.
14+
///
15+
/// This trait expects index 0 to contain the _front_ element.
16+
/// The _back_ element must refer to the element with the largest index.
17+
/// These two rules above should be upheld by manual implementors.
1418
pub trait List: Reflect + Array {
15-
/// Appends an element to the list.
19+
/// Appends an element to the _back_ of the list.
1620
fn push(&mut self, value: Box<dyn Reflect>);
1721

18-
/// Removes the last element from the list (highest index in the array) and returns it, or [`None`] if it is empty.
22+
/// Removes the _back_ element from the list and returns it, or [`None`] if it is empty.
1923
fn pop(&mut self) -> Option<Box<dyn Reflect>>;
2024

2125
/// Clones the list, producing a [`DynamicList`].

0 commit comments

Comments
 (0)