toggle
Removes item from items if it is there, adds it at the end if it is not: the usual
“toggle a selection” gesture. Only the first occurrence is removed.
Import
Section titled “Import”Cargo feature array (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
items | &[T] | The current elements. |
item | T | The element to toggle, compared with ==. |
Returns
Section titled “Returns”Vec<T> — A new Vec; items is not changed.
