diff options
Diffstat (limited to 'engine/src/file_format/wavefront/common.rs')
| -rw-r--r-- | engine/src/file_format/wavefront/common.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/engine/src/file_format/wavefront/common.rs b/engine/src/file_format/wavefront/common.rs index 8cdfb34..83fd8af 100644 --- a/engine/src/file_format/wavefront/common.rs +++ b/engine/src/file_format/wavefront/common.rs @@ -1,5 +1,7 @@ use std::num::{ParseFloatError, ParseIntError}; +use engine_ecs::util::array_vec::ArrayVec; + macro_rules! keyword { ( $(#[$attr: meta])* @@ -68,9 +70,11 @@ where let mut parts = line.split(' '); let keyword = KeywordT::from_str(parts.next().unwrap(), line_no)?; - let arguments = parts - .map(|part| Value::parse::<KeywordT>(part, line_no)) - .collect::<Result<Vec<_>, _>>()?; + let mut arguments = ArrayVec::<Value, 16>::default(); + + for part in parts { + arguments.push(Value::parse::<KeywordT>(part, line_no)?); + } Ok(Some(Statement { keyword, arguments })) } @@ -265,7 +269,7 @@ impl Value pub struct Statement<KeywordT: Keyword> { pub keyword: KeywordT, - pub arguments: Vec<Value>, + pub arguments: ArrayVec<Value, 16>, } impl<KeywordT: Keyword> Statement<KeywordT> |
