Compare commits

..

No commits in common. "master" and "0.2.0" have entirely different histories.

4 changed files with 12 additions and 13 deletions

View file

@ -26,8 +26,7 @@ impl ExcelCollection {
} }
} }
#[must_use] pub fn table_count(&self) -> usize {
pub const fn table_count(&self) -> usize {
1 1
} }
} }

View file

@ -1,7 +1,9 @@
#[must_use]
pub fn load_or_create_config(path: &str, defaults: &str) -> String { pub fn load_or_create_config(path: &str, defaults: &str) -> String {
std::fs::read_to_string(path).unwrap_or_else(|_| { std::fs::read_to_string(path).map_or_else(
|_| {
std::fs::write(path, defaults).unwrap(); std::fs::write(path, defaults).unwrap();
defaults.to_string() defaults.to_string()
}) },
|data| data,
)
} }

View file

@ -13,8 +13,8 @@ pub async fn query_dispatch() -> String {
retcode: 0, retcode: 0,
region_list: CONFIGURATION region_list: CONFIGURATION
.game_servers .game_servers
.values() .iter()
.map(|c| RegionInfo { .map(|(_, c)| RegionInfo {
name: c.name.clone(), name: c.name.clone(),
title: c.title.clone(), title: c.title.clone(),
env_type: c.env_type.clone(), env_type: c.env_type.clone(),
@ -46,7 +46,7 @@ pub async fn query_gateway(
Gateserver { Gateserver {
retcode: 0, retcode: 0,
ip: server_config.gateserver_ip.clone(), ip: server_config.gateserver_ip.clone(),
port: u32::from(server_config.gateserver_port), port: server_config.gateserver_port as u32,
asset_bundle_url: version_config.asset_bundle_url.clone(), asset_bundle_url: version_config.asset_bundle_url.clone(),
ex_resource_url: version_config.ex_resource_url.clone(), ex_resource_url: version_config.ex_resource_url.clone(),
lua_url: version_config.lua_url.clone(), lua_url: version_config.lua_url.clone(),

View file

@ -1,8 +1,6 @@
use std::path::Path;
pub fn main() { pub fn main() {
let proto_file = "StarRail.proto"; let proto_file = "StarRail.proto";
if Path::new(proto_file).exists() { if std::path::Path::new(proto_file).exists() {
println!("cargo:rerun-if-changed={proto_file}"); println!("cargo:rerun-if-changed={proto_file}");
prost_build::Config::new() prost_build::Config::new()