Copy and appends all elements in a slice to the `BoxVec`. # Errors This method will return an error if the capacity left (see [`remaining_capacity`]) is smaller then the length of the provided slice. [`remaining_capacity`]: #method.remaining_capacity
(&mut self, other: &[T])
| 236 | /// |
| 237 | /// [`remaining_capacity`]: #method.remaining_capacity |
| 238 | pub fn try_extend_from_slice(&mut self, other: &[T]) -> Result<(), CapacityError> |
| 239 | where |
| 240 | T: Copy, |
| 241 | { |
| 242 | if self.remaining_capacity() < other.len() { |
| 243 | return Err(CapacityError::new(())); |
| 244 | } |
| 245 | |
| 246 | let self_len = self.len(); |
| 247 | let other_len = other.len(); |
| 248 | |
| 249 | unsafe { |
| 250 | let dst = self.as_mut_ptr().add(self_len); |
| 251 | ptr::copy_nonoverlapping(other.as_ptr(), dst, other_len); |
| 252 | self.set_len(self_len + other_len); |
| 253 | } |
| 254 | Ok(()) |
| 255 | } |
| 256 | |
| 257 | /// Create a draining iterator that removes the specified range in the vector |
| 258 | /// and yields the removed items from start to end. The element range is |
nothing calls this directly
no test coverage detected