Skip to main content

eth_icons/
result.rs

1use crate::{Error, Icon};
2
3#[derive(Debug, Clone)]
4pub enum IconResult {
5    Found(Icon),
6    NotFound,
7    Unsupported,
8}
9
10impl From<Icon> for IconResult {
11    fn from(icon: Icon) -> Self {
12        IconResult::Found(icon)
13    }
14}
15
16impl From<Option<Icon>> for IconResult {
17    fn from(icon: Option<Icon>) -> Self {
18        match icon {
19            Some(icon) => IconResult::Found(icon),
20            None => IconResult::NotFound,
21        }
22    }
23}
24
25#[derive(Debug)]
26pub struct SourceResult {
27    pub source: &'static str,
28    pub result: Result<IconResult, Error>,
29}