inline is faster here

This commit is contained in:
famfo 2022-02-13 11:13:33 +01:00
parent ba9fd8dfe7
commit c1e907dbcd

View file

@ -64,12 +64,14 @@ impl From<EncodingError> for CifError {
type Result<T> = std::result::Result<T, CifError>;
#[inline]
fn join_to_arraystring<const C: usize>(elems: &[&str], str: &mut ArrayString<C>) -> Result<()> {
for (i, item) in elems.iter().enumerate() {
if i > 0 {
str.try_push(' ')?;
}
str.try_push_str(item)?;
//str.push_str(item);
}
Ok(())
}
@ -85,6 +87,7 @@ fn lines_read_noempty<T: UnsafeBufRead>(lines: &mut UnsafeLines<T>) -> Result<Op
Ok(None)
}
#[inline]
fn assert_trailing_leading(s: &str) -> Result<()> {
if s.is_empty() || s.as_bytes()[0] == 32 || s.as_bytes()[s.len() - 1] == 32 {
return Err(IllegalWhitespaceError(s.to_string()))