C++ property types for setter/getter ? #278
Unanswered
ahayzen-kdab
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Situation
Currently we have the following
const T& getter() const
fn getter(&self) -> &T
void setter(const T&)
fn setter(&mut self, T)
Possible changes
If we changed this to use
T
for the setter would this prevent copies in the C++ side, would we be able to "move" the value? Would QML respect this and would C++ developers understand this or would there be no advantage?const T& getter() const
fn getter(&self) -> &T
void setter(T)
fn setter(&mut self, T)
Note that we can't use the assignment operator shortcut which usually occurs when going from a
const T&
toT
, as our field is stored in the Rust struct.Beta Was this translation helpful? Give feedback.
All reactions