Struct kioto::runtime::Runtime[][src]

pub struct Runtime { /* fields omitted */ }

A Runtime handles the application event loop and connects to the various device drivers.

Examples

use kioto::runtime;

fn main() {
    let mut runtime = runtime::Runtime::new();
    runtime.run_with(|runtime| {
      runtime.shutdown();

      Ok(())
    });
}

Implementations

impl Runtime[src]

pub fn new() -> Self[src]

Create a new runtime with the default configuration.

Examples

use kioto::runtime;

fn main() {
  let runtime = runtime::Runtime::new();
}

pub fn run_with<F>(&mut self, callback: F) -> Result<(), Error> where
    F: Fn(&mut Runtime) -> Result<(), Error>, 
[src]

Run the runtime loop with the given callback which is called once per tick until shutdown.

Examples

use kioto::runtime;

fn main() {
  let mut runtime = runtime::Runtime::new();
  runtime.run_with(|runtime| {
    runtime.shutdown();

    Ok(())
  });
}

pub fn shutdown(&mut self)[src]

Schedules the loop for termination after the next tick completes.

Examples

use kioto::runtime;

fn main() {
    let mut runtime = runtime::Runtime::new();
    runtime.run_with(|runtime| {
        runtime.shutdown();

        Ok(())
    });
}

Trait Implementations

impl Drop for Runtime[src]

Auto Trait Implementations

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