Struct sorting_visualization::array::Array [−][src]
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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
[src]
pub fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
[src]
T: Parameter<Self>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,