Move fn_lib into State, and use StaticVec for function call arguments in dotting/indexing chains.

This commit is contained in:
Stephen Chung
2020-05-07 10:00:10 +08:00
parent 8e60976cfa
commit fb64adca93
3 changed files with 123 additions and 107 deletions

View File

@@ -117,6 +117,16 @@ impl<T: Default + Clone> StaticVec<T> {
self.list[..num].iter().chain(self.more.iter())
}
/// Get a mutable iterator to entries in the `StaticVec`.
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut T> {
let num = if self.len >= self.list.len() {
self.list.len()
} else {
self.len
};
self.list[..num].iter_mut().chain(self.more.iter_mut())
}
}
impl<T: Default + Clone + fmt::Debug> fmt::Debug for StaticVec<T> {