(&mut self, new_len: usize)
| 935 | /// regarding what you find in the inactive portion of the vec. |
| 936 | #[inline(always)] |
| 937 | pub fn set_len(&mut self, new_len: usize) { |
| 938 | if new_len > A::CAPACITY { |
| 939 | // Note(Lokathor): Technically we don't have to panic here, and we could |
| 940 | // just let some other call later on trigger a panic on accident when the |
| 941 | // length is wrong. However, it's a lot easier to catch bugs when things |
| 942 | // are more "fail-fast". |
| 943 | panic!( |
| 944 | "ArrayVec::set_len> new length {} exceeds capacity {}", |
| 945 | new_len, |
| 946 | A::CAPACITY |
| 947 | ) |
| 948 | } |
| 949 | |
| 950 | let new_len: u16 = new_len |
| 951 | .try_into() |
| 952 | .expect("ArrayVec::set_len> new length is not in range 0..=u16::MAX"); |
| 953 | self.len = new_len; |
| 954 | } |
| 955 | |
| 956 | /// Splits the collection at the point given. |
| 957 | /// |
no outgoing calls
no test coverage detected