swap3
Provides utility functions for simultaneously swapping three values by rotating them
either left (abc
→ bca
) or right (abc
→ cab
). These functions can come in handy e.g.
when rotating elements of a binary tree in list representation.
The provided functions work on arbitrary types and do not require the type to be Clone
, Copy
or Default
.
Examples
For individual references, the swap3_bca
(rotate left) and swap3_cab
(rotate right)
functions are available:
For slices, the swap3_bca_slice
and swap3_cab_slice
functions can be used:
use *;