Skip to content

Commit

Permalink
Added Vec append to BufferVec - Issue bevyengine#3531 (bevyengine#8575)
Browse files Browse the repository at this point in the history
# Objective

- Fixes bevyengine#3531 

## Solution

- Added an append wrapper to BufferVec based on the function signature
for vec.append()

---

First PR to Bevy. I didn't see any tests for other BufferVec methods
(could have missed them) and currently this method is not used anywhere
in the project. Let me know if there are tests to add or if I should
find somewhere to use append so it is not dead code. The issue mentions
implementing `truncate` and `extend` which were already implemented and
merged
[here](https://github.com/bevyengine/bevy/pull/6833/files#diff-c8fb332382379e383f1811e30c31991b1e0feb38ca436c357971755368012ced)
  • Loading branch information
Connor-McMillin authored May 9, 2023
1 parent b4218a4 commit f786ad4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/bevy_render/src/render_resource/buffer_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ impl<T: Pod> BufferVec<T> {
index
}

pub fn append(&mut self, other: &mut BufferVec<T>) {
self.values.append(&mut other.values);
}

pub fn set_label(&mut self, label: Option<&str>) {
let label = label.map(str::to_string);

Expand Down

0 comments on commit f786ad4

Please sign in to comment.