You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When deriving a uniffi::Record I have a few fields of type Duration and was hoping to give them a default value. However it seems at the moment the proc macros don't accept literals for it, despite durations being somewhat primitive types from the Built-in types table.
It would be great if the proc macros can be extended to accept expressions for Duration.
I only use Uniffi for Kotlin code, where there should be equivalents to construct the default value in a data class but I'm not sure if this is possible in other languages as well.
For Duration I'd imagine accepting the const constructors:
Thanks, then I'll better not try to implement support for a default value for those.
IIRC there is currently no support for default values when using custom types. But it's really just a nice to have for me, and I can live with this not having a default value.
When deriving a
uniffi::Record
I have a few fields of typeDuration
and was hoping to give them a default value. However it seems at the moment the proc macros don't accept literals for it, despite durations being somewhat primitive types from the Built-in types table.It would be great if the proc macros can be extended to accept expressions for
Duration
.I only use Uniffi for Kotlin code, where there should be equivalents to construct the default value in a
data class
but I'm not sure if this is possible in other languages as well.For
Duration
I'd imagine accepting the const constructors:Duration::from_secs
Duration::from_millis
Duration::from_micros
And eventually:
Duration::from_secs_f32
Duration::from_secs_f64
For example:
The text was updated successfully, but these errors were encountered: