export some builtin traits,

brightness conversion fails for invalid values,

macros for wrapping attrs
This commit is contained in:
Vinzenz Schroeter 2025-06-16 14:56:24 +02:00
parent bffc905261
commit f4c7519658
21 changed files with 210 additions and 133 deletions

View file

@ -1,3 +1,4 @@
use crate::errors::ServicePointError;
use crate::UniffiCustomTypeConverter;
use servicepoint::Brightness;
@ -10,7 +11,8 @@ impl UniffiCustomTypeConverter for Brightness {
where
Self: Sized,
{
Ok(Brightness::saturating_from(val))
Ok(Brightness::try_from(val)
.map_err(|value| ServicePointError::InvalidBrightness { value })?)
}
fn from_custom(obj: Self) -> Self::Builtin {