export some builtin traits,
brightness conversion fails for invalid values, macros for wrapping attrs
This commit is contained in:
parent
bffc905261
commit
f4c7519658
21 changed files with 210 additions and 133 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue