mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
49ff42cc69
# Objective - Nightly clippy lints should be fixed before they get stable and break CI ## Solution - fix new clippy lints - ignore `significant_drop_in_scrutinee` since it isn't relevant in our loop https://github.com/rust-lang/rust-clippy/issues/8987 ```rust for line in io::stdin().lines() { ... } ``` Co-authored-by: Jakob Hellermann <hellermann@sipgate.de>
30 lines
717 B
Rust
30 lines
717 B
Rust
//! This example demonstrates you can create a custom runner (to update an app manually). It reads
|
|
//! lines from stdin and prints them from within the ecs.
|
|
|
|
use bevy::prelude::*;
|
|
use std::io;
|
|
|
|
struct Input(String);
|
|
|
|
fn my_runner(mut app: App) {
|
|
println!("Type stuff into the console");
|
|
for line in io::stdin().lines() {
|
|
{
|
|
let mut input = app.world.resource_mut::<Input>();
|
|
input.0 = line.unwrap();
|
|
}
|
|
app.update();
|
|
}
|
|
}
|
|
|
|
fn print_system(input: Res<Input>) {
|
|
println!("You typed: {}", input.0);
|
|
}
|
|
|
|
fn main() {
|
|
App::new()
|
|
.insert_resource(Input(String::new()))
|
|
.set_runner(my_runner)
|
|
.add_system(print_system)
|
|
.run();
|
|
}
|