fix zero_and_clear
This commit is contained in:
@@ -57,17 +57,20 @@ impl<const MAX_LEN: usize, T: Sized> FixedVec<MAX_LEN, T> {
|
|||||||
unsafe { core::slice::from_raw_parts_mut(self.buffer.as_mut_ptr() as *mut T, self.length) }
|
unsafe { core::slice::from_raw_parts_mut(self.buffer.as_mut_ptr() as *mut T, self.length) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn zero_and_clear(&mut self) {
|
|
||||||
self.as_slice_mut().fill(0);
|
|
||||||
self.length = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn clear(&mut self) {
|
pub fn clear(&mut self) {
|
||||||
self.length = 0;
|
self.length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<const MAX_LEN: usize> FixedVec<MAX_LEN, u8> {
|
||||||
|
pub fn zero_and_clear(&mut self) {
|
||||||
|
self.as_slice_mut().fill(0);
|
||||||
|
self.length = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
impl<const MAX_LEN: usize, T: Debug> Debug for FixedVec<MAX_LEN, T> {
|
impl<const MAX_LEN: usize, T: Debug> Debug for FixedVec<MAX_LEN, T> {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
|
||||||
Debug::fmt(self.as_slice(), f)
|
Debug::fmt(self.as_slice(), f)
|
||||||
|
|||||||
Reference in New Issue
Block a user