gpui-phosphor 0.1.0

An unofficial GPUI component and asset source for Phosphor Icons
Documentation
use crate::Weight;
use std::{error::Error, fmt};

/// Errors returned when an icon cannot be made available by the selected
/// Cargo features.
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)]
pub enum IconError {
    /// The requested weight was not enabled for this build.
    WeightNotEnabled(Weight),
}

impl fmt::Display for IconError {
    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            Self::WeightNotEnabled(weight) => write!(
                formatter,
                "the `{weight}` Phosphor weight is disabled; enable the `{weight}` Cargo feature"
            ),
        }
    }
}

impl Error for IconError {}