AsObjectArg trait enabling implicit conversions for object parameters#800
AsObjectArg trait enabling implicit conversions for object parameters#800
AsObjectArg trait enabling implicit conversions for object parameters#800Conversation
|
Can't comment much as I don't really understand what this will achieve. With this I see you are not calling explicitly .clone anymore in some cases. Does it still clone in those cases or not anymore? |
Possibly in the initial implementation, but my plan is definitely to get rid of any unnecessary clones. Since this would then be an internal perf improvement, it might be a separate PR. |
|
I think we could just use This would probably force the trait to be an unsafe trait though, since it'd effectively erase the type. But it should also simplify implementation a fair bit. |
|
The problem with I might see how bad it is, maybe we can reuse code somehow. |
fa413fa to
475fc0d
Compare
|
API docs are being generated and will be shortly available at: https://godot-rust.github.io/docs/gdext/pr-800 |
AsArg trait enabling implicit conversions for object parameters (WIP)AsObjectArg trait enabling implicit conversions for object parameters
56f6387 to
f1b25a5
Compare
f1b25a5 to
733a776
Compare
733a776 to
84505ba
Compare
|
Also declared bugfix, since it fixes #156 which wasn't previously possible. |
Adds a trait
AsObjectArg<T>.Godot engine functions that have a parameter
impl AsObjectArg<T>will now accept:Gd<U>whereU: Inherits<T>&Gd<U>Option<Gd<U>>Option<&Gd<U>>Gd::null_arg(), a special expression only valid for null argumentsCloses #156.
Closes #796.
Needs to land in v0.2 because some call-site patterns like
node.clone().upcast()are now ambiguous and no longer possible.Older message
To be decided:
impl AsArg<T> for Gd<T>(i.e. values, not just references)?&objOption<Gd<T>>andOption<&Gd<T>>are supported)RawGdcreates lots of copies, and may be unsafe/unsound to cast, plus needs destructor deactivatedArgViewtype wrapping a pointer?