feat: move helper functions to a separate file

Former-commit-id: 4f173e40b700e633d8bf6ac85970f5f5f7412ff0
This commit is contained in:
Muhammad Nauman Raza 2023-11-29 22:40:30 +00:00
parent d21dfe06ae
commit 0eb210eafe
2 changed files with 12 additions and 8 deletions

9
src/helpers.rs Normal file
View 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(),
}
}

View file

@ -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