Struct sorting_visualization::app::App[][src]

pub struct App {
    state: SharedState,
    algorithm_thread: JoinHandle<()>,
}

This struct contains all rendering, updating and input handling logic.

Fields

state: SharedStatealgorithm_thread: JoinHandle<()>

Implementations

impl App[src]

pub fn init(
    algorithm: Box<dyn Algorithm + Send>,
    array: Vec<u32>,
    speed: f64
) -> Self
[src]

Creates a new app (with a state constructed from the given array) and starts an algorithm thread. This function is called init instead of new because it has side effects.

pub fn render(
    &mut self,
    args: RenderArgs,
    gl: &mut GlGraphics,
    glyphs: &mut GlyphCache<'_>
)
[src]

Draws the current state.

pub fn update(&mut self, args: UpdateArgs)[src]

Advances the state by a given amount of time.

pub fn button(&mut self, args: ButtonArgs)[src]

Handles user input and updates the state.

Controls

KeyAction
Spacepause/resume
2x faster
2x slower

Trait Implementations

impl Debug for App[src]

Auto Trait Implementations

impl !RefUnwindSafe for App

impl Send for App

impl Sync for App

impl Unpin for App

impl !UnwindSafe for App

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, 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.