Skip to content

Commit

Permalink
Update the doc comments for drain to make it clear that the origina…
Browse files Browse the repository at this point in the history
…l value is left empty.
  • Loading branch information
andriyDev committed Sep 26, 2024
1 parent 5cce145 commit cd73ed6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion crates/bevy_reflect/src/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ pub trait List: PartialReflect {
/// Returns an iterator over the list.
fn iter(&self) -> ListIter;

/// Drain the elements of this list to get a vector of owned values.
/// Drain the elements of this list to get a vector of owned values. After calling this
/// function, `self` will be empty. The order of items in the returned
/// [`Vec`] will match the order of items in `self`.
fn drain(&mut self) -> Vec<Box<dyn PartialReflect>>;

/// Clones the list, producing a [`DynamicList`].
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_reflect/src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ pub trait Map: PartialReflect {
/// Returns an iterator over the key-value pairs of the map.
fn iter(&self) -> MapIter;

/// Drain the key-value pairs of this map to get a vector of owned values.
/// Drain the key-value pairs of this map to get a vector of owned values. After calling this
/// function, `self` will be empty.
fn drain(&mut self) -> Vec<(Box<dyn PartialReflect>, Box<dyn PartialReflect>)>;

/// Clones the map, producing a [`DynamicMap`].
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_reflect/src/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ pub trait Set: PartialReflect {
/// Returns an iterator over the values of the set.
fn iter(&self) -> Box<dyn Iterator<Item = &dyn PartialReflect> + '_>;

/// Drain the values of this set to get a vector of owned values.
/// Drain the values of this set to get a vector of owned values. After calling this function,
/// `self` will be empty.
fn drain(&mut self) -> Vec<Box<dyn PartialReflect>>;

/// Clones the set, producing a [`DynamicSet`].
Expand Down

0 comments on commit cd73ed6

Please sign in to comment.