Skip to content

How can i know which value to put in a setter for a duration type field? #6372

Answered by ogoffart
D4yvid asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, this is milliseconds. Documented there: https://releases.slint.dev/1.8.0/docs/rust/slint/docs/type_mappings/

Why not using a std::time::Duration as the argument instead of i64?

That is a very good question. The reason is that we can't use std::time::Duration as field of a generated struct or property because it is not repr(C) and because we also support other language like C++, it needs to be binary compatible.

We could have made so that we use std::time::Duration for things that are only exposed to rust, and u64 for things that needs to be shared, but unfortunately we didn't do that before Slint 1.0. (Would have made things more complicated)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@D4yvid
Comment options

Answer selected by D4yvid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants