Skip to main content

Swap

Trait Swap 

Source
pub trait Swap {
    // Required method
    fn cswap(&mut self, other: &mut Self, selector: U8);
}
Expand description

Best effort constant time swapping of values.

Required Methods§

Source

fn cswap(&mut self, other: &mut Self, selector: U8)

Depending on selector, keep everything as is, or swap self and other.

If selector == 0, the values are unchanged, otherwise swap.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Swap for [u8]

Source§

fn cswap(&mut self, other: &mut Self, selector: U8)

Source§

impl Swap for [u16]

Source§

fn cswap(&mut self, other: &mut Self, selector: U8)

Source§

impl Swap for [u32]

Source§

fn cswap(&mut self, other: &mut Self, selector: U8)

Source§

impl Swap for [u64]

Source§

fn cswap(&mut self, other: &mut Self, selector: U8)

Implementors§