use crate::errors::ServicePointError; use crate::UniffiCustomTypeConverter; use servicepoint::Brightness; uniffi::custom_type!(Brightness, u8); impl UniffiCustomTypeConverter for Brightness { type Builtin = u8; fn into_custom(val: Self::Builtin) -> uniffi::Result where Self: Sized, { Ok(Brightness::try_from(val) .map_err(|value| ServicePointError::InvalidBrightness { value })?) } fn from_custom(obj: Self) -> Self::Builtin { obj.into() } }