Struct sorting_visualization::array::Array[][src]

pub struct Array(SharedState);

A convenient wrapper around SharedState for algorithms that handles concurrency and all that stuff. All methods in this struct lock the state for as short as possible so that the rendering thread can lock it when it wants.

Implementations

impl Array[src]

pub fn new(state: SharedState) -> Self[src]

Creates a new array from a copy of SharedState.

pub fn wait(&self, ms: u64)[src]

Puts the current thread to sleep for the specified amount of time and blocks it if the animation is paused.

pub fn len(&self) -> usize[src]

Returns the length of the underlying vector.

pub fn get(&self, index: usize) -> u32[src]

Returns a value at a given index.

pub fn set(&self, index: usize, value: u32)[src]

Sets a value of the at a given index.

pub fn swap(&self, a: usize, b: usize)[src]

Swaps two values at given indices.

pub fn shuffle(&self)[src]

Shuffles the Array.

pub fn reset_color(&self, index: usize)[src]

Resets color of the value at a given index (sets it to the transparent color).

See State.colors

pub fn set_color(&self, index: usize, color: Color)[src]

Sets color of the value at a given index.

See State.colors

Trait Implementations

impl Clone for Array[src]

impl Debug for Array[src]

Auto Trait Implementations

impl RefUnwindSafe for Array

impl Send for Array

impl Sync for Array

impl Unpin for Array

impl UnwindSafe for Array

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SetParameter for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.