mirror of
https://github.com/rust-embedded/heapless.git
synced 2025-10-02 06:50:32 +00:00
Fix safety comments on pop_terminator
This commit is contained in:
parent
435615bf26
commit
1d64fb0a55
@ -217,11 +217,14 @@ impl<const N: usize> CString<N> {
|
|||||||
|
|
||||||
/// Removes the nul byte terminator from the inner buffer.
|
/// Removes the nul byte terminator from the inner buffer.
|
||||||
///
|
///
|
||||||
/// # Safety: caller must ensure to re-add the terminator after this function is called
|
/// # Safety
|
||||||
|
///
|
||||||
|
/// Callers must ensure to re-add the nul terminator after this function is called.
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn pop_terminator(&mut self) {
|
unsafe fn pop_terminator(&mut self) {
|
||||||
debug_assert_eq!(self.vec.last(), Some(&0));
|
debug_assert_eq!(self.vec.last(), Some(&0));
|
||||||
|
|
||||||
|
// Safety: We always have the nul terminator at the end.
|
||||||
unsafe { self.vec.pop_unchecked() };
|
unsafe { self.vec.pop_unchecked() };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user