fn update(self, world: &mut World) -> Option<Self> {
        match self {
            State::Start => {
                let (mesh, progress) = {
                    let mut progress = ProgressCounter::new();
                    let loader = world.read_resource::<Loader>();
                    let a = loader.load("mesh.ron", Ron, (), &mut progress, &world.read_resource());

                    (a, progress)
                };

                world.create_entity().with(mesh).build();

                Some(State::Loading(progress))
            }
            State::Loading(progress) => match progress.complete() {
                Completion::Complete => Some(State::SomethingElse),
                Completion::Failed => {
                    eprintln!("Asset loading failed!");
                    eprintln!("-- Errors --");
                    progress.errors().iter().enumerate().for_each(|(n, e)| {
                        eprintln!("{}: error: {}", n, e.error);
                        for cause in e.error.iter().skip(1) {
                            eprintln!("{}: caused by: {}", n, cause);
                        }
                    });
                    eprintln!("Quitting game..");

                    None
                }
                Completion::Loading => Some(State::Loading(progress)),
            },
            State::SomethingElse => {
                // You could now start the actual game, cause the loading is done.
                // This example however will just quit.

                println!("Mesh is loaded and the game can begin!");
                println!("Game ending, sorry");

                None
            }
        }
    }
/// Returns `Some` if the app should quit.
Returns `Some` if the app should quit.
Returns ` Some ` if the app should quit .
fn update(self, world: &mut World) -> Option<Self> {
        match self {
            State::Start => {
                let (mesh, progress) = {
                    let mut progress = ProgressCounter::new();
                    let loader = world.read_resource::<Loader>();
                    let a = loader.load("mesh.ron", Ron, (), &mut progress, &world.read_resource());
                    (a, progress)
                };
                world.create_entity().with(mesh).build();
                Some(State::Loading(progress))
            }
            State::Loading(progress) => match progress.complete() {
                Completion::Complete => Some(State::SomethingElse),
                Completion::Failed => {
                    eprintln!("Asset loading failed!");
                    eprintln!("-- Errors --");
                    progress.errors().iter().enumerate().for_each(|(n, e)| {
                        eprintln!("{}: error: {}", n, e.error);
                        for cause in e.error.iter().skip(1) {
                            eprintln!("{}: caused by: {}", n, cause);
                        }
                    });
                    eprintln!("Quitting game..");
                    None
                }
                Completion::Loading => Some(State::Loading(progress)),
            },
            State::SomethingElse => {
                // You could now start the actual game, cause the loading is done.
                // This example however will just quit.
                println!("Mesh is loaded and the game can begin!");
                println!("Game ending, sorry");
                None
            }
        }
    }
fn update ( self , world : & mut World ) -> Option < Self > { match self { State :: Start => { let ( mesh , progress ) = { let mut progress = ProgressCounter :: new ( ) ; let loader = world . read_resource :: < Loader > ( ) ; let a = loader . load ( " " , Ron , ( ) , & mut progress , & world . read_resource ( ) ) ; ( a , progress ) } ; world . create_entity ( ) . with ( mesh ) . build ( ) ; Some ( State :: Loading ( progress ) ) } State :: Loading ( progress ) => match progress . complete ( ) { Completion :: Complete => Some ( State :: SomethingElse ) , Completion :: Failed => { eprintln ! ( " " ) ; eprintln ! ( " " ) ; progress . errors ( ) . iter ( ) . enumerate ( ) . for_each ( | ( n , e ) | { eprintln ! ( " " n e error ) ; for cause in e . error . iter ( ) . skip ( 1 ) { eprintln ! ( " " n cause ) ; } } ) ; eprintln ! ( " " ) ; None } Completion :: Loading => Some ( State :: Loading ( progress ) ) , } , State :: SomethingElse => { // You could now start the actual game, cause the loading is done. // This example however will just quit. println ! ( " " ) ; println ! ( " " ) ; None } } }
Returns `Some` if the app should quit.
Returns ` Some ` if the app should quit .
self
world
&mut World
self
world
&mut World