allow inlining (this did not provide a statistically significant performance boost - oh well)
This commit is contained in:
11
src/lib.rs
11
src/lib.rs
@@ -72,11 +72,13 @@ impl AnimationFrames for Vec<Image> {
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn from_base36(str: &str) -> u64 {
|
||||
u64::from_str_radix(str, 36).expect(&format!("Invalid base36 string: {}", str))
|
||||
}
|
||||
|
||||
/// this doesn't work inside ToBase36 for some reason
|
||||
#[inline]
|
||||
fn to_base36(int: u64) -> String {
|
||||
format!("{}", radix_36(int))
|
||||
}
|
||||
@@ -86,12 +88,14 @@ pub trait ToBase36 {
|
||||
}
|
||||
|
||||
impl ToBase36 for u64 {
|
||||
#[inline]
|
||||
fn to_base36(&self) -> String {
|
||||
to_base36(*self)
|
||||
}
|
||||
}
|
||||
|
||||
/// e.g. `\nNAME DLG_0`
|
||||
#[inline]
|
||||
fn optional_data_line<T: Display>(label: &str, item: Option<T>) -> String {
|
||||
if item.is_some() {
|
||||
format!("\n{} {}", label, item.unwrap())
|
||||
@@ -100,6 +104,7 @@ fn optional_data_line<T: Display>(label: &str, item: Option<T>) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn transform_line_endings(input: String, mode: TransformMode) -> String {
|
||||
let mut input = Cursor::new(input);
|
||||
let mut output = Cursor::new(Vec::new());
|
||||
@@ -108,6 +113,7 @@ fn transform_line_endings(input: String, mode: TransformMode) -> String {
|
||||
String::from_utf8(output.into_inner()).unwrap()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn segments_from_string(string: String) -> Vec<String> {
|
||||
let mut output:Vec<String> = Vec::new();
|
||||
// are we inside `"""\n...\n"""`? if so, ignore empty lines
|
||||
@@ -133,8 +139,9 @@ fn segments_from_string(string: String) -> Vec<String> {
|
||||
output
|
||||
}
|
||||
|
||||
// for some reason the sprites with numeric IDs go first,
|
||||
// then SPR A (avatar), then all the non-numeric IDs
|
||||
/// for some reason the sprites with numeric IDs go first,
|
||||
/// then SPR A (avatar), then all the non-numeric IDs
|
||||
#[inline]
|
||||
fn is_string_numeric(str: String) -> bool {
|
||||
for c in str.chars() {
|
||||
if !c.is_numeric() {
|
||||
|
||||
Reference in New Issue
Block a user