Improvements
This commit is contained in:
parent
bc590d0502
commit
36e4b12934
1 changed files with 14 additions and 0 deletions
|
@ -36,6 +36,20 @@ impl TArray {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn capacity(&self) -> u32 {
|
||||||
|
self.cap
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn clear(&mut self, len: u32) -> Self {
|
||||||
|
if self.data_ptr != 0 && self.len > 0 {
|
||||||
|
let data = unsafe {
|
||||||
|
std::slice::from_raw_parts_mut(self.data_ptr as *mut u8, self.len)
|
||||||
|
};
|
||||||
|
data.fill(0);
|
||||||
|
self.len = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub(crate) fn resize_grow(&mut self, count: Option<u32>) -> u32 {
|
pub(crate) fn resize_grow(&mut self, count: Option<u32>) -> u32 {
|
||||||
let count = count.unwrap_or(1);
|
let count = count.unwrap_or(1);
|
||||||
|
|
Loading…
Reference in a new issue