Skip to content

Conversation

@Bromeon
Copy link
Member

@Bromeon Bromeon commented May 1, 2025

Another small signals QoL feature -- allows emit() arguments to be mostly passed like in other engine APIs, e.g.

  • i32, Vector2 and other Copy types by value
  • Gd, DynGd, Variant, Array, Dictionary by reference
  • Strings by reference or "string" literals

AsArg for objects isn't quite as flexible as AsObjectArg, which allows derived-to-base conversions. Generalizing AsArg the obvious way creates problems in other places, such as

let obj: Gd<...> = ...;
let a = array![&obj]; // type inference fails now

So we'd need to find a solution for array! to maybe not just call push() but do something with the types first.

Bromeon added 3 commits May 1, 2025 18:06
Allows types to be *mostly* passed like in other engine APIs, e.g.
- `i32`, `Vector2` and other `Copy` types by value
- `Gd`, `DynGd`, `Variant`, `Array`, `Dictionary` by reference
- Strings by reference or "string" literals
@Bromeon Bromeon added quality-of-life No new functionality, but improves ergonomics/internals c: core Core components labels May 1, 2025
@Bromeon Bromeon added this to the 0.3 milestone May 1, 2025
@GodotRust
Copy link

API docs are being generated and will be shortly available at: https://godot-rust.github.io/docs/gdext/pr-1150

@Bromeon Bromeon added this pull request to the merge queue May 1, 2025
Merged via the queue into master with commit aed6925 May 1, 2025
17 checks passed
@Bromeon Bromeon deleted the qol/emit-asarg branch May 1, 2025 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: core Core components quality-of-life No new functionality, but improves ergonomics/internals

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants