use crate::config::theme::Theme;
use crate::io::buffer_output::buffer_output::BufferOutput;
use crate::io::output::Metadata;
use crate::mocks::with_scroll_interpreter::WithScrollWidgetInterpreter;
use crate::widget::widget::Widget;
use crate::widgets::with_scroll::with_scroll::WithScroll;
#[derive(Clone, Debug)]
pub struct MetaOutputFrame {
pub buffer: BufferOutput,
pub metadata: Vec<Metadata>,
pub theme: Theme,
}
impl MetaOutputFrame {
pub fn get_meta_by_type(&self, typename: &'static str) -> impl Iterator<Item = &Metadata> {
self.metadata.iter().filter(move |i| i.typename == typename)
}
pub fn get_scroll<T: Widget>(&self) -> impl Iterator<Item = WithScrollWidgetInterpreter<T>> {
self.get_meta_by_type(WithScroll::<T>::TYPENAME_FOR_MARGIN)
.map(|meta| WithScrollWidgetInterpreter::new(self, meta))
}
}