cosmic/widget/table/model/category.rs
1use std::borrow::Cow;
2
3use crate::widget::Icon;
4
5/// Implementation of std::fmt::Display allows user to customize the header
6/// Ideally, this is implemented on an enum.
7pub trait ItemCategory:
8 Default + std::fmt::Display + Clone + Copy + PartialEq + Eq + std::hash::Hash
9{
10 /// Function that gets the width of the data
11 fn width(&self) -> iced::Length;
12}
13
14pub trait ItemInterface<Category: ItemCategory> {
15 fn get_icon(&self, category: Category) -> Option<Icon>;
16 fn get_text(&self, category: Category) -> Cow<'static, str>;
17
18 fn compare(&self, other: &Self, category: Category) -> std::cmp::Ordering;
19}