feat: move helper functions to a separate file
Former-commit-id: 4f173e40b700e633d8bf6ac85970f5f5f7412ff0
This commit is contained in:
parent
d21dfe06ae
commit
0eb210eafe
9
src/helpers.rs
Normal file
9
src/helpers.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
use crate::helpers;
|
||||
|
||||
pub fn titlecase(s: &str) -> String {
|
||||
let mut c = s.chars();
|
||||
match c.next() {
|
||||
None => String::new(),
|
||||
Some(f) => f.to_uppercase().collect::<String>() + c.as_str(),
|
||||
}
|
||||
}
|
11
src/main.rs
11
src/main.rs
|
@ -9,6 +9,9 @@ use bevy::{
|
|||
use std::collections::HashMap;
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
mod helpers;
|
||||
use crate::helpers::*;
|
||||
|
||||
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
const PKGNAME: &str = env!("CARGO_PKG_NAME");
|
||||
|
||||
|
@ -31,14 +34,6 @@ lazy_static!{
|
|||
].iter().copied().collect();
|
||||
}
|
||||
|
||||
fn titlecase(s: &str) -> String {
|
||||
let mut c = s.chars();
|
||||
match c.next() {
|
||||
None => String::new(),
|
||||
Some(f) => f.to_uppercase().collect::<String>() + c.as_str(),
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
// Only run the app when there is user input, significantly reducing CPU/GPU usage
|
||||
|
|
Reference in a new issue