gpui_phosphor/error.rs
1use crate::Weight;
2use std::{error::Error, fmt};
3
4/// Errors returned when an icon cannot be made available by the selected
5/// Cargo features.
6#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)]
7pub enum IconError {
8 /// The requested weight was not enabled for this build.
9 WeightNotEnabled(Weight),
10}
11
12impl fmt::Display for IconError {
13 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
14 match self {
15 Self::WeightNotEnabled(weight) => write!(
16 formatter,
17 "the `{weight}` Phosphor weight is disabled; enable the `{weight}` Cargo feature"
18 ),
19 }
20 }
21}
22
23impl Error for IconError {}