use avr_device::atmega2560::TC0; use ufmt::{Formatter, uDisplay, uWrite}; pub struct SimpleVector { size: usize, array: [T] } impl SimpleVector { pub fn new(size: usize, array: [T]) -> Self { Self { size, array } } pub fn push(&mut self, byte: T) { let array : &[T]; if self.size > 0 { array = &mut self.array[0..self.size]; array[self.size] = byte; } else { array = &mut [byte]; } self.array = array; self.size = self.size + 1; } } impl<'a, T> Iterator for SimpleVector<'a, T> { type Item = T; fn next(&mut self) -> Option { todo!() } } impl<'a, T> uDisplay for SimpleVector<'a, T> { fn fmt(&self, _: &mut Formatter<'_, W>) -> Result<(), W::Error> where W: uWrite + ?Sized { todo!() } } #[macro_export] macro_rules! vector { ($array:expr) => { Vector::new(&mut $array.len(), $array) }; }