method List.remove
Removes and returns the element at index i; later elements move one place down.
Example:
fn main() io {
var xs = [10, 20, 30]
let x = xs.remove(1)
print("{x} {xs}")
}Вывод
20 [10, 30]
Removes and returns the element at i. Panics when i is out of range.
Example:
fn main() io {
var xs = ["a", "b", "c"]
let b = xs.remove(1)
print("{b} {xs}")
}Вывод
b ["a", "c"]
pub(api) var fn remove(i: usize) -> TСложность. O(n) in the number of elements after `i`.
С версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
i | usize |
Возвращает
T
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/core/collections.oxl:241