Skip to main content

eth_icons/
icon.rs

1use std::fmt::{Debug, Display};
2
3use bytes::Bytes;
4
5#[derive(Clone, PartialEq, Eq, Hash)]
6pub struct Icon {
7    pub bytes: Bytes,
8    pub mime_type: Option<String>,
9}
10
11impl Display for Icon {
12    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13        write!(
14            f,
15            "Icon(size: {:?}, mime_type: {})",
16            self.bytes.len(),
17            self.mime_type.as_ref().unwrap_or(&"unknown".to_string())
18        )
19    }
20}
21
22impl Debug for Icon {
23    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
24        write!(
25            f,
26            "Icon(size: {:?}, mime_type: {})",
27            self.bytes.len(),
28            self.mime_type.as_ref().unwrap_or(&"unknown".to_string())
29        )
30    }
31}