pub trait SetLen {
// Required method
unsafe fn set_len(&mut self, new_len: usize);
}Expand description
SetLen is a trait defining the unsafe set_len method
on ringbuffers that support the operation.
Required Methods§
Sourceunsafe fn set_len(&mut self, new_len: usize)
unsafe fn set_len(&mut self, new_len: usize)
Force the length of the ringbuffer to new_len.
Note that downsizing will not call Drop on elements at new_len..old_len,
potentially causing a memory leak.
§Panics
Panics if new_len is greater than the ringbuffer capacity.
§Safety
- Safe when
new_len <= old_len. - Safe when
new_len > old_lenand all the elements atold_len..new_lenare already initialized.